If you want to use a custom font in your Android app, the easiest way is to add it as an asset.

This works for both XML and Java layouts. You can then reference this asset from your layout files using the syntax @font/myFont .

You can also load fonts programmatically by creating a Typeface object and passing it into setTypeface() on TextView or EditText . However, this method requires more code than adding an asset. If you are loading multiple fonts at once, I recommend using the AssetManager class instead of doing everything manually with Typeface objects.

The following sections will go over all three methods: assets, programmatic loading and manual loading via Typefaces

Back to Main