Next, open Android Studio, right-click on the res folder, and select New > Android Resource Directory.
From the “Resource type” menu, select font and click on the OK button.
Now, font folder is added to the res directory. When you download a font, you will get .ttf files. Copy the 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.
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.
Use small letters and add the underscore between the words.
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:
<TextView android:id="@+id/text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SemicolonSpace" 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.