Custom font in android

if u want to apply custom font to your textview text or button follow the below steps..
1. go to google n download the font and keep them inside ur assets folder.
2.suppose u want to apply custom font to ur textview text:

 TextView t1 = (TextView)findViewById(R.id.txtAmount);

Typeface face1 = Typeface.createFromAsset(activity.getAssets(),"Arvo-Regular.ttf");
//where Arvo-Regular.ttf referes to your font which is placed inside ur assets folder.

 t1.setTypeface(face1);
//it will set the font of ur textview

same way u have to do it for buttons etc..

ex..


                Typeface face1 = Typeface.createFromAsset(ctx.getAssets(),"Arvo-Regular.ttf");
       TextView t1 = (TextView)findViewById(R.id.txtAmount);
                  t1.setTypeface(face1);

Comments

Popular Posts