Custom Ttf Fonts Are Not Showing Properly In Textview On Android 4.4 Kitkat
I have some text which has some bolded parts. Until KitKat this strategy (as mentioned in this post) worked perfectly well My strings resources file:
Solution 2:
Apparently this is a bug in KitKat and has been fixed in an internal tree.
Solution 3:
Put your custom font in android assets under folder name "font" or whatever you want
Try this
myTypeface = Typeface.createFromAsset(this.getAssets(),
"fonts/<<your font>>.ttf");
in onCreate()
then
[use youcontroll].setTypeface(myTypeface);
Best of Luck...
Solution 4:
I resolved the problem by converting my file.ttf to file.otf
remplace :
Typefacetypeface= Typeface.createFromAsset(activity.getAssets(), "fonts/ostrich_regular.ttf");
yourTextView.setTypeface(typeface);
by :
Typefacetypeface= Typeface.createFromAsset(activity.getAssets(), "fonts/ostrich_regular.otf");
yourTextView.setTypeface(typeface);
FYI : the .otf format work for all android version (not only on kitkat)
Solution 5:
After many hours searching for roboto.otf (2014 year) I understood that it was a mistake. Simply download a normal ttf font from https://www.fontsquirrel.com/fonts/roboto-2014 and copy to assets folder, then use setTypeface. Also you may convert it to otf with any web-site.
Post a Comment for "Custom Ttf Fonts Are Not Showing Properly In Textview On Android 4.4 Kitkat"