Custom Font in Android Example in Android Studio

In this post, we’ll show you an example of custom font for Android app in the Android studio. We can set custom font for the android app by using TypeFace class but we have pass every TextView class object to TypeFace method in order to apply custom font for every text view.

In this, we’ll show you how to apply custom font in android app easily and in less time.

We will chrisjenx calligraphy library to apply custom font for Android app. This library will help us to apply custom font for every text view in the Android project.

Let us see how it is done.

Initially, copy and paste these two dependencies in-app level gradle and sync the project.

here we used build tools version 26.0.1, you with what you are using in your project.

Create assets folder and a subfolder font in it, place the custom font in font folder.

custom font in android example

After syncing the project, create a class called FontClass and extend the Application class.

Initiate this class in the AndroidManifest.xml using android:name attribute in the opening application tag.

Now we’ll modify the styles.xml and activity_main.xml a bit.



In fie, we’ll place attachBaseContext() method. This method applies the custom font to all the views in the activity layout file.

We should place this method in every activity.

See the output below:


custom font in android example

You May Also Like

About the Author: Sama Gyani

I am Computer Science Graduate. I turn my interests into posts here.

Leave a Reply

Your email address will not be published. Required fields are marked *