我有一个button
使用 Android 小部件创建。我想将按钮文本的字体设置为Helv Neue 67 Med Cond
。如何获取这个字体并将其设置为android布局文件中的按钮文本?
我想您可能已经找到了答案,但如果没有(以及其他开发人员),您可以这样做:
1.您要将“Helv Neue 67 Med Cond.ttf”保存到资产文件夹中。
然后
对于文本视图
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface typeface = Typeface.createFromAsset(getAssets(), "Helv Neue 67 Med Cond.ttf");
txt.setTypeface(typeface);
对于按钮
Button n=(Button) findViewById(R.id.button1);
Typeface typeface = Typeface.createFromAsset(getAssets(), "Helv Neue 67 Med Cond.ttf");
n.setText("show");
n.setTypeface(typeface);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)