开发者

Set the fonts toa text in android

Hi want to change the font type to atext according to spinner selectio开发者_运维知识库n like arial balck,Thlist etc.any one have idea ? suggest me


You should change the typefaces of your text views. You can specify a variable:

Typeface typeface = Typeface.DEFAULT;

Then when the user chooses another font you reinitialize this variable, using the built-in typefaces, or loading your own from .ttf files, that you can place in assets/fonts directory. Loading own fonts can be done with this call:

typeface = Typeface.createFromAsset(context.getAssets(),
                "fonts/font.ttf");

This should do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜