Pan*_*che 8 android android-layout
可能重复:
如何更改android中文本视图的字体?
我尝试了很多为我的应用程序中的TextView设置字体.但似乎没有办法在android中设置字体.我想通过xml为我的所有TextView设置Arial字体.我将Arial.ttf添加到我的资产中仍然无法在xml中设置样式.请找我一个出路.
fer*_*tar 23
AFAIK你不能用xml来做,你必须在代码中做到这一点:
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/Arial.otf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19895 次 |
| 最近记录: |