skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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.

    enter image description here

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/inter_bold" />
    
    Login or Signup to reply.
  3. you could use default font in android studio like this:

    1. click Resource Manager (leftmost of android studio)
    2. find "Font" tab, if it not visible, click more button
    3. click (+) button and choose ‘More Fonts…’
    4. choose or search font
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search