Tutorial - How to make Downloadable Fonts with Android Support Library
Downloadable Fonts
In last Google I/0 2017 Google announced API which allow programers create app that allows request fonts from the application, instead attaching them inside APK. It is possible from Android 4.0 and higher. We have more than 850 different fonts available in google fonts which we can use.
Advantages:
- fonts are shared across multiple applications so it improves the overall health of the system.
- reduce size of APK
Lets do it!
First of all we have add API support Library 26 or newer one.
implementation 'com.android.support:appcompat-v7:26.1.0'
Example layout:
Downloadable fonts via XML
Layout Editor -> TextView -> Properties -> fontFamily -> more Fonts
After that we shoud have 3 more files:
res/values/font_certs.xml
res/values/preloaded_fonts.xml
- res/font/selected_font_name.xml
Setting our font in XML
Downloadable fonts in entive application
We need to make sure that our AppTheme style is set to application inside
GitHub link: https://github.com/babelek/downloadableFont
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not refer to or relate to an open-source repository. See here for a definition of "open-source."
You can contact us on Discord.
[utopian-moderator]