Android:字体错误:不允许的类型。
我正在创建一个样式 xml 文档,但遇到了问题。我想使用 droid serif 字体,但无法在模拟器中使用它,只能在 Eclipse 的预览屏幕中使用。有时我可以编写
而不会出现错误,但是当我尝试在 Android 模拟器中运行该程序时,出现错误:错误:错误:不允许整数类型(在'android:typeface'处,值为'2')。
当我按ctrl+space
查看我可以写什么时节目(除其他外) serif
,但是当我写
时,它说单词“serif”不正确拼写。
。
这是 .xml 文件中的部分:
<style name="Header">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#444444</item>
<item name="android:paddingBottom">15dp</item>
<item name="android:gravity">center</item>
<item name="android:typeface">serif</item>
</style>
I am creating a style xml document, and I've ran into a problem. I want to use the droid serif font, but I can't use it in an emulator, only in the preview screen in Eclipse. Sometimes I can write <Item name="android:typeface">2</item>
without getting an error, but when I try to run the program in the Android Emulator, I get an error: error: Error: Integer types not allowed (at 'android:typeface' with value '2').
When i press ctrl+space
to see what I can write it shows (among others) serif
, however when i write <Item name="android:typeface">serif</item>
it says The word 'serif' is not correctly spelled.
.
Here's the part from the .xml file:
<style name="Header">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#444444</item>
<item name="android:paddingBottom">15dp</item>
<item name="android:gravity">center</item>
<item name="android:typeface">serif</item>
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Eclipse 有一个针对 XML 中字符串值的拼写检查器...如果拼写检查器无法识别单词,通常您会得到“拼写不正确”的信息。如果确实如此,它仍然应该编译并工作。也许这就是这里发生的事情?
Eclipse has a spell checker for string values in XML...usually you get the "not correctly spelled" thing if it is a word that the spell checker does not recognize. It should still compile and work though, if this is actually the case. Maybe that's what's going on here?