How To Define Style That Use Custom Font
I would like to use Roboto font as default font for every TextViews, EditTexts, Buttons, etc in my app. I've put the ttf file in the fonts folder inside assets folder. Now I would
Solution 1:
You can't do it the way you want. The android:typeface
attribute is an enum and has a fixed number of values. It doesn't take a filename.
What you can do is implement a custom TextView
(plus custom Button
and EditText
inheriting from their respective classes) that reads a custom attribute and loads the font file that the attribute points to.
Bear in mind that Roboto is meant to be used from Honeycomb onwards (or was it ICS?). It does look a bit out of place on older devices, where Droid Sans is the system-wide default.
Post a Comment for "How To Define Style That Use Custom Font"