我想将我的android应用程序字体更改为自定义字体并更改字体大小。包括所有活动和对象以及警报对话框。这个怎么做?
我自己弄清楚了。这是我使用的代码。我创建了具有自定义字体作为默认字体的自定义TextView。使用自定义Textview到您的Andrid应用程序
public class MyTextView extends TextView {
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyTextView(Context context) {
super(context);
init();
}
public void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "font/chiller.ttf");
setTypeface(tf ,1);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句