Question
I applied a custom font to a TextView
, but it doesn't seems to change the
typeface.
Here is my 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?
Answer
On Mobiletuts+ there is very good tutorial on Text formatting for Android. [Quick Tip: Customize Android Fonts](http://code.tutsplus.com/tutorials/customize-android-fonts-- mobile-1601/ "Quick Tip: Customize Android Fonts")
EDIT: 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
assets/fonts
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
this way must be in lower case