[英]String types not allowed (at 'android:typeface' with value 'Calibri.ttf')
如何将自定义字体设置为应用程序字体? 这是我的设置:
/assets/fonts/Calibri.TTF
android:theme="@style/AppTheme"
style.xml
: <resources> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="android:typeface">Calibri.ttf</item> </style> </resources>
现在,我无法运行该应用程序。 当我尝试编译它时,出现如下错误:
error: Error: String types not allowed (at 'android:typeface' with value 'Calibri.ttf')
字体值应类似于这些值。 “正常,无,serif,等宽”
您需要将您的海关字体从Calibri.ttf重命名为calibri.ttf
其次,您不能直接在资源文件中提供字体
尝试在github上引用它
是的,反思。 这个作品看下面的stackoverflow问题是否可以为整个应用程序设置自定义字体?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.