Skip to content Skip to sidebar Skip to footer

Android - Fonts In Application

I have added an external font in /assets directory, and manually doing setFacetype(font). Isn't there a general way to set the whole application to use a specific font if you have

Solution 1:

You cannot use your custom fonts through to whole application in a general way.

You cannot set your custom fonts through xml files.

You have to use the Typeface functions in your code to use your custom fonts within your application.

Solution 2:

tv=(TextView)findViewById(res);
Typefacefont= Typeface.createFromAsset(this.getAssets(), "MYFONT.TTF"); 
tv.setTypeface(font);

This also how to use it in a textview.

For whole application go to Using a custom typeface in Android.

and go to Manish Singla answer

Solution 3:

TypefacemTypeface=  Typeface.createFromAsset(getAssets(), "YOUR FONT NAME");
textview.setTypeface(mTypeface, Typeface.NORMAL);

Post a Comment for "Android - Fonts In Application"