【发布时间】:2016-05-27 14:26:05
【问题描述】:
我已经在 onCreate() 方法中设置了我的应用程序类的默认字体,详见书法文档:
CalligraphyConfig.initDefault(new CalligraphyConfig.
.setDefaultFontPath("fonts/MetaOT-Medi.otf")
.setFontAttrId(R.attr.fontPath)
.addCustomViewWithSetTypeface(CustomViewWithTypefaceSupport.class)
.addCustomStyle(TextField.class, R.attr.textFieldStyle)
.build()
);
我有一个 TextView,并希望它使用默认系统字体(例如 Roboto)回退。我可以知道怎么做吗?
现在我通过将一组 Roboto 字体复制到我的资产/字体文件夹来规避这个问题,然后对于那些我想回退的 TextView,覆盖字体以在 xml 中使用它,例如 fontPath="fonts/Roboto-Regular.ttf"。或者除此之外还有更好的解决方案吗?
【问题讨论】:
标签: android fonts android-fonts