Android:字体错误:类型不允许。
问题描述:
我正在创建一个样式xml文档,并且遇到了问题。我想使用droid衬线字体,但是我不能在模拟器中使用它,只能在Eclipse的预览屏幕中使用它。有时我可以写入<Item name="android:typeface">2</item>
而不会出现错误,但是当我尝试在Android模拟器中运行该程序时,出现错误:error: Error: Integer types not allowed (at 'android:typeface' with value '2').
当我按ctrl+space
来查看我可以写入的内容时(除其他外)serif
,但是当我写<Item name="android:typeface">serif</item>
它说The word 'serif' is not correctly spelled.
。Android:字体错误:类型不允许。
下面是从.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>
答
Eclipse可以在XML字符串值拼写检查...通常你会得到“拼写不正确”的事情,如果它是一个字的拼写检查程序无法识别。如果事实确实如此,它仍然应该编译和工作。也许这就是这里发生的事情?
如果是这样的话:你可以选择单词,点击右键,然后选择“快速修复”以禁用拼写检查器,将单词添加到词典中,忽略等。 – koopaking3 2012-02-18 01:31:24
哇......我真的认为它会比这个更基本一些。谢谢。 – MartinHaTh 2012-02-18 01:38:14