可以在Android中更改Edittext,Radio Button和CheckBox的字体类型 [英] can the font type of an Edittext,Radio Button and CheckBox be changed in Android

查看:59
本文介绍了可以在Android中更改Edittext,Radio Button和CheckBox的字体类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android的初学者.我可以在Android中更改Textview的字体类型.但是我必须使用资产文件夹中的.ttf文件来进行这种字体更改.

I am a beginner in android.I can able to change the font type of a Textview in Android.But I have to use .ttf file in asset folder,to bring this kind of font change.

TextView text = (TextView) layout.findViewById(R.id.text);
text.setText(msg);
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/handsean.ttf");
text.setTypeface(font); 

上面的代码是我用来更改文本View字体的内容,但是我还需要更改单选按钮,Edittext和Check复选框(Im在我的应用程序中也使用过)的文本的字体类型.请在这里帮助我.谢谢.

The above code is what I used to change the font of a text View.but I need to change the font type of the text of Radio Button,Edittext and Check box(which Im also used in my application) as well.Plz help me out here.Thanks in advance.

推荐答案

是的,您必须遵循此处提到的相同代码.这同样适用于其他控件,例如Edittext,CheckBox等.

Yes you have to follow the same code wht u have mentioned here.This will work for other controls too like Edittext,CheckBox etc.

这篇关于可以在Android中更改Edittext,Radio Button和CheckBox的字体类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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