在android应用程序中设置自定义字体
作者:互联网
是否可以一次性为整个Android应用程序设置自定义字体.我的意思是我不想在每个活动中为每个textview使用setTypeFace.不仅是文本视图,还有每个可能的文本.
解决方法:
只需制作自己的TextView:
public class CustomFontTextView extends TextView {
// make every constructor call init();
private void init() {
setTypeFace(...);
}
}
在xml中:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.yourcompany.yourproject.views.CustomFontTextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Test"/>
</LinearLayout>
标签:custom-font,android 来源: https://codeday.me/bug/20190723/1512167.html