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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -