How to Add Custom Fonts in Android Studio?

Custom Fonts in Android Studio

It’s easy to add custom fonts in the Android Studio project. First, visit the Google Fonts website. It is a library of 1504 open-source font families and beautiful icons. For this article, I’m using Poppins font. Open the fonts page and click on the “Download family” button.

Poppins font download

You will get a zip file with all the font styles. Extract it. Next, open Android Studio, right-click on the res folder, and select New > Android Resource Directory.

Android studio resource directory

From the “Resource type” menu, select font and click on the OK button.

font resource directory

Now, font folder is added to the res directory. Open the Poppins folder (that you extracted). You will find .ttf files.

Poppins Folder

Copy the .ttf files and paste them into our new font folder (right-click on the folder and select paste). Now, expand the folder. You may see errors.

custom font errors

This is because the name of the resources should be written in small characters. Also, we should only use the underscore to separate the words. To change their name, right-click on the font and select Refactor > Rename.

rename font resources

Use small letters and add the underscore between the words.

fonts rename

Now, you have successfully added the fonts to your project. Let’s see how to use them in the code.

If you are using XML:

You can use android:fontFamily tag to add fonts:



    android:fontFamily="@font/poppins_bold" />

If you are using Jetpack Compose:

There are different ways to use custom fonts. Follow this article on Jetpack Compose Themes.

This is how you add custom fonts in Android Studio. If you have any doubts, comment below.


Leave a Comment