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.
精彩评论