androidandroid-studio

How to use custom font in a project written in Android Studio


I was trying to use custom font in Android Studio as we did in Eclipse. But unfortunately could not figure out where to put the 'assets' folder!


Solution

  • Update 2025:

    Create a folder named font inside the res folder and copy your font

    enter image description here

    All font names must be only: lowercase a-z, 0-9, or underscore.

    <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fontFamily="@font/abc_font" />
    

    For programmatic use:

    textView.setTypeface(ResourcesCompat.getFont(context, R.font.abc_font))
    

    For Android Studio 4.2+ there's even now a menu option:

    enter image description here