How to change fontFamily of a button text through layout XML file in android? -


the title pretty describes question. want change font of text written on button using xml files. possible? simple textview, works:

android:fontfamily="sans-serif" 

but buttons, how can using only layout xml files?

android comes 3 fonts (sans, serif, monospace) can accesed using android:typeface=”font_name”. using own fonts, read this article. may 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); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -