开发者

Set the fonts toa text in android

开发者 https://www.devze.com 2023-03-26 10:13 出处:网络
Hi want to change the font type to atext according to spinner selectio开发者_运维知识库n like arial balck,Thlist etc.any one have idea ? suggest meYou should change the typefaces of your text views. Y

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

精彩评论

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