Reputation: 4576
The title pretty much describes my question. I want to change the font of the text written on my button using XML files. Is it possible? For a simple TextView, this works:
android:fontFamily="sans-serif"
But for buttons, how can we do it by using only the layout xml files?
Upvotes: 1
Views: 5385
Reputation: 898
Android comes with 3 fonts (Sans, Serif, Monospace)
which can be accesed using android:typeface=”FONT_NAME”
. For using your own fonts, read this article. May it will help.
Programmatically
Button n=(Button) findViewById(R.id.button1);
Typeface typeface = Typeface.createFromAsset(getAssets(), "Helv Neue 67 Med Cond.ttf");
n.setText("show");
n.setTypeface(typeface);
Upvotes: 3
Reputation: 1367
Maybe you could use this:
android:typeface=”FONT_NAME”
Hope it helps.
Upvotes: 1