问题描述
我申请自定义字体到的TextView
,但它似乎并不改变字体。
I applied a custom font to a TextView
, but it doesn't seems to change the typeface.
下面是我的code:
Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/myFont.ttf");
TextView myTextView = (TextView)findViewById(R.id.myTextView);
myTextView.setTypeface(myTypeface);
任何人都可以,请让我离开这个问题?
Can anyone please get me out of this issue?
推荐答案
在Mobiletuts +上有文本格式为Android非常好的教程。 快速提示:定制的Android字体
On Mobiletuts+ there is very good tutorial on Text formatting for Android. Quick Tip: Customize Android Fonts
编辑:现在测试它自己。这里是解决方案。您可以使用一个子文件夹名为字体,但它必须在资产
文件夹不是 RES
文件夹。因此,
Tested it myself now. Here is the solution. You can use a subfolder called fonts but it must go in the assets
folder not the res
folder. So
资产/字体
另外,还要确保结束我的意思是字体的结局字体文件本身都是小写。换句话说,它不应该是 myFont.TTF
,但 myFont.ttf
Also make sure that the font ending I mean the ending of the font file itself is all lower case. In other words it should not be myFont.TTF
but myFont.ttf
这篇关于Android的 - 使用自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!