8

Possible Duplicate:
how to change the font on the text view in android?

I tried a lot to set font for the TextView in my app. But there is no way seems to set font in android. I want to set Arial font for all of my TextView through xml. I added Arial.ttf to my assets still unable to set style in xml. Please find me a way out.

Community
  • 1
  • 1
Panache
  • 987
  • 5
  • 16
  • 35
  • 1
    Here is a similar Question/Answer that I think may help: http://stackoverflow.com/questions/2888508/how-to-change-the-font-on-the-text-view-in-android – plainjimbo Jun 07 '11 at 20:56

1 Answers1

23

AFAIK you can't do it in xml, you have to do it in code:

Typeface tf = Typeface.createFromAsset(getAssets(),
            "fonts/Arial.otf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf)
ferostar
  • 7,074
  • 7
  • 38
  • 61