Set Custom Fonts in android

 You can define your own custom fonts for the strings in your application. You just need to download the required font from the internet, and then place it in assets/fonts folder.

After putting fonts in the assets folder under fonts folder, you can access it in your java code through Typeface class. First , get the reference of the text view in the code. Its syntax is given below 

TextView tx = (TextView)findViewById(;

The next thing you need to do is to call static method of Typeface class createFromAsset() to get your custom font from assets. Its syntax is given below −

Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/font name.ttf");

The last thing you need to do is to set this custom font object to your TextView Typeface property. You need to call setTypeface() method to do that. Its syntax is given below −


Apart from these Methods, there are other methods defined in the Typeface class , that you can use to handle Fonts more effectively.

Sr.No Method & description

create(String familyName, int style)

Create a Typeface object given a family name, and option style information


create(Typeface family, int style)

Create a Typeface object that best matches the specified existing Typeface and the specified Style


createFromFile(String path)

Create a new Typeface from the specified font file


defaultFromStyle(int style)

Returns one of the default Typeface objects, based on the specified style



Returns the Typeface's intrinsic style attributes