Ajn Ajn - 29 days ago 19
Android Question

Setting Button text font in android

I have a

button
created using android widgets. I want to set the font of the button text to
Helv Neue 67 Med Cond
. How to get this font and set it to the button text in android layout file?

Answer

First you have to put the ttf file in assets folder and then You can use the below code to set Custom font in TextView, same way you can do for Button:

TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Helv Neue 67 Med Cond.ttf");
txt.setTypeface(font);