2012-02-18 99 views
0

我正在創建一個樣式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> 

回答

1

Eclipse可以在XML字符串值拼寫檢查...通常你會得到「拼寫不正確」的事情,如果它是一個字的拼寫檢查程序無法識別。如果事實確實如此,它仍然應該編譯和工作。也許這就是這裏發生的事情?

+0

如果是這樣的話:你可以選擇單詞,點擊右鍵,然後選擇「快速修復」以禁用拼寫檢查器,將單詞添加到詞典中,忽略等。 – koopaking3 2012-02-18 01:31:24

+0

哇......我真的認爲它會比這個更基本一些。謝謝。 – MartinHaTh 2012-02-18 01:38:14

相關問題