android 字体修改

第一步,在assets目录下新建fonts目录,把ttf字体文件放到这。
第二步,程序中调用:
AssetManager mgr=getAssets();//得到AssetManager
Typeface tf=Typeface.createFromAsset(mgr, "ygydfhc.ttf");
caiNiXiHuan.setTypeface(tf);
2.在xml文件中使用android:textStyle=”bold” 可以将英文设置成粗体,  但是不能将中文设置成粗体,
将中文设置成粗体的方法是:
TextView tv = (TextView)findViewById(R.id.TextView01);
tv.getPaint().setFakeBoldText(true);//中文仿“粗体”--使用TextPaint的仿“粗体”设置setFakeBoldText为true。

你可能感兴趣的:(Android开发,Android开发,字体)