Skip to content
Search

Android:Font

lastmod 2016-05-27created 2016-05-271 edits

The fonts provided by default in Android are listed below. You can set them directly in an XML Layout using the android:typeface attribute.

List of Typeface

Font name

Attribute value

sans || android:typeface="sans"

serif || android:typeface="serif"

monospace || android:typeface="monospace"

How to apply a separate font file in code

To change the font of specific text in Android, use the TypeFace class. If the font file exists at assets/fonts/msgothic.ttc, you can apply it as follows.

TextView.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/msgothic.ttc"));

Favorite site