I want to add different fonts in the Android Studio. Actually, I have already added the font family in the Android but when I use the font family in code it gives me an error.
I want to add fonts in the Android Studio and just want to learn how to add more fonts in Android Studio.
3
Answers
To add fonts as resources, perform the following steps in Android Studio:
Right-click the res folder and go to New > Android resource directory. The New Resource Directory window appears.
In the Resource type list, select font, then click OK
Add your font files in the font folder.
The folder structure below generates R.font.dancing_script, R.font.lobster, and R.font.typo_graphica.
Double-click a font file to preview the file’s fonts in the editor
Note: The name of the resource directory must be font.
If you want to add fonts as resources, please perform the following steps in Android Studio:
Create a folder named font inside the res folder and copy your font.
Font names can only consist of lowercase letters a-z, numbers 0-9, or underscore.
you could use default font in android studio like this: