Adding custom fonts to your application

Posted on Updated on

Bored of using same old default fonts in your android applications? So today I am going to explain how to add custom fonts to your android application. Well, Android supports True Type fonts (ttf) and Open Type fonts (otf). The following steps describes adding customs fonts

1. Create a new Android Project in Eclipse say for example “SampleFontProject” explained here

2. In the main.xml add a Textview

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android=""
 android:text="This is a sample custom font text"

3.Now in the project directory right click the folder namedassetand create a new folderfonts

4.Copy the font file to the “fonts” folder

SampleFontProject -> asset -> fonts -> Dekar.otf

The custom font which I have used in this project is Dekar.otf

5.Open the main activity file and insert the following code into the onCreate() method:

TextView txt = (TextView) findViewById(; 
Typeface font=Typeface.createFromAsset(getAssets(),"fonts/Dekar.otf"); 

6.Run the application.

2 thoughts on “Adding custom fonts to your application

    Sergey said:
    June 8, 2012 at 11:17 am

    The code under point 5 is not readeble to the end. It is cut off from the right. Browsers: Chrome, Safary. Mac OS X.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s