1.res中font目录
TextView txtNormal = (TextView) findViewById(R.id.txt_helvetica);
Typeface typeface = ResourcesCompat.getFont(this, R.font.test_ttf);
txtNormal.setTypeface(typeface);
2.Assets及fonts目录
TextView txtNormal = (TextView) findViewById(R.id.txt_helvetica);
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/test_ttf.ttf");
txtNormal.setTypeface(typeface);
网友评论