Android: Working with Fonts

Fonts feature can be used from Android O version. You can create "font" folder in resources folder of your application. Below Font features are providing in Android O release.

  • Fonts in XML
  • System Fonts

Fonder name in Android application: res/font/

Adding the font files in the resource directory

Using Fonts in XML file:

Using Fonts Programatically:
Typeface typeface = getResources().getFont(R.font.myfont);
Retrieving System Fonts:
FontManager fontManager = context.getSystemService(FontManager.class);
FontConfig systemFontsData = fontManager.getSystemFonts();

For more information, Check in official Android developer documentation.

1 comment: