| Start |
|---|
| Custom font in canvas text Drawing text in canvas with your font from assets. |
| Working with fonts in Android O Android O changes the way to work with fonts. Android O introduces a new feature, called Fonts in XML, which allows you to use fonts as resources. This means, that there is no need to bundle fonts as assets. Fonts are now compiled in an R file and are automatically available in the system as a resource. In order to add a new font, you have to do the following:
You can also create your own font family by adding the following XML file into the You can use both the font file and the font family file in the same way: Or like this: |
Custom font to whole activity Then in your activity, in |
Putting a custom font in your app
|
Initializing a font |
Using a custom font in a TextView |
| Apply font on TextView by xml (Not required Java code) TextViewPlus.java: attrs.xml: (Where to place res/values) How to use: |
| Efficient Typeface loading Loading custom fonts can be lead to a bad performance. I highly recommend to use this little helper which saves/loads your already used fonts into a Hashtable. } Usage: |
Read Article
https://develop.horje.com/learn/1434/reference