Using custom fonts

Fonts are assets. So to provide some fonts for your application we need to copy them first. There are a lot of good free font resources. For example, Google Fonts. Download some fonts and copy them to your assets directory. If there is no assets directory create one. We will place our fonts in the assets/fonts directory.

In our examples, we will use Exo. Exo comes with the following font files:

  • Exo2-Black.ttf
  • Exo2-BlackItalic.ttf
  • Exo2-Bold.ttf
  • Exo2-BoldItalic.ttf
  • Exo2-ExtraBold.ttf
  • Exo2-ExtraBoldItalic.ttf
  • Exo2-ExtraLight.ttf
  • Exo2-ExtraLightItalic.ttf
  • Exo2-Italic.ttf
  • Exo2-Light.ttf
  • Exo2-LightItalic.ttf
  • Exo2-Medium.ttf
  • Exo2-MediumItalic.ttf
  • Exo2-Regular.ttf
  • Exo2-SemiBold.ttf
  • Exo2-SemiBoldItalic.ttf
  • Exo2-Thin.ttf
  • Exo2-ThinItalic.ttf ...

Get Mastering Android Development with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.