Android - Using Custom Font
After trying most of the solutions described in this thread, I accidentally found Calligraphy (https://github.com/chrisjenx/Calligraphy) - a library by Christopher Jenkins that lets you easily add custom fonts to your app. The advantages of his lib comparing to approaches suggested here are:
- you don't have to introduce your own overriden TextView component, you use the built-in TextView
- you can easily include the library using gradle
- The library doesn't limit your choice of fonts; you just add your preferred ones to the assets dir
- you not only get custom text views — all the other text-based Android compontents will also be displayed using your custom font.
On Mobiletuts+ there is very good tutorial on Text formatting for Android. 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