Use Custom Fonts In Android Application

Applying a custom font to a TextView in your Android Application can be done in a few step. First get the desired fonts, either in Truetype ttf or OpenType otf format. Place the file in the assets folder in the root of your application.

Now in your main Activity file apply the font to your TextView like this in the onCreate() method:

TextView txt = (TextView) findViewById(R.id.custom_text);
Typeface font = Typeface.createFromAsset(getAssets(), "font.ttf");
txt.setTypeface(font);

Replace font.ttf with your font filename, e.g. “daxcondensed-bold.ttf”.

Posted in Android Tagged with: , , , , ,