Android的帮助更改按钮字体类型,如何? [英] Android Help with Changing Button Font Type, How?

查看:126
本文介绍了Android的帮助更改按钮字体类型,如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改按钮上的文本显示的字体,我设法与在屏幕上,TextView的文字做到这一点,但无法找到任何信息,或采用这一个按钮帮助。

i would like to change the font that appears on the button text, i have managed to do this with text on the screen, textview, but cannot find any info, or help with applying this to a button.

我是新手,所以提供code的话,将是非常美联社preciated。这就是我'使用的TextView的,但我如何改变按钮字体?

I 'am novice, so providing the code to do so, would be much appreciated. This is what i'am using for the textview, but how do i change the button font?

TextView txt = (TextView) findViewById(R.id.custom_font);  
Typeface font = Typeface.createFromAsset(getAssets(), "1543Humane_jenson_bold.TTF");  
txt.setTypeface(font);

谢谢 露西 X

Thanks Lucy x

推荐答案

按钮 IS-A TextView的,所以只是做它作为一个TextView的:

Button IS-A TextView, so just do it as with a TextView:

Button txt = (Button) findViewById(R.id.custom_font);  
Typeface font = Typeface.createFromAsset(getAssets(), "1543Humane_jenson_bold.TTF");  
txt.setTypeface(font);

这篇关于Android的帮助更改按钮字体类型,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆