S Zain Bukhari S Zain Bukhari - 8 days ago 6
Android Question

How to import external font/ typeface in ANDROID STUDIO?

I wanna know how do I use an external font in Android Studio as there is no Assets folder. I have look for a helpful turtorial on internet but they all pretend to use Assets folder. I created an asset folder myself in src/main but Android Studio doesnt recognie getAssets(). So help me maybe :)

Thank You

Answer

Go on your Project: app-->src-->main

Create a assets folder like this:

|assets

    |-----------------fonts

        |-------------------font.ttf

|java

|res

AndroidManifest.xml

and then use

     Typeface face=Typeface.createFromAsset(getAssets(),"fonts/digital.ttf");
     txtV.setTypeface(face);
Comments