0

As per https://stackoverflow.com/a/13329907/3286489, we could change the fontFamily of the TextView. But how could I set that using Java code? I can't find the API.

Community
  • 1
  • 1
Elye
  • 53,639
  • 54
  • 212
  • 474
  • if you wants to change the fontTypeFace of textview specifically the you may provide a style attribute to TextView type at styles document and add the font family to that, after that you dont need to setTypeFace to any of the textview. – Ankush Bist Jun 14 '16 at 04:48
  • Found my answer through http://stackoverflow.com/a/14344132/3286489 – Elye Jun 14 '16 at 07:11

1 Answers1

1

You can use the setTypeface() method on TextView in java code .

Typeface font = Typeface.createFromAsset( getAssets(), "fonts/fontawesome-webfont.ttf" );
TextView tv = (TextView)findViewById(R.id.textview1);
tv.setTypeface(font);

Please visit the API link

Hope you got your answer !!!

Naveen Tamrakar
  • 3,349
  • 1
  • 19
  • 28
prashant0205
  • 269
  • 1
  • 3
  • 17