天天看點

Android出現In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing錯誤資訊

錯誤資訊:

[2017-08-16 20:38:40 - appcompat_v7] ERROR: In <declare-styleable> MenuView, unable to find attributeandroid:preserveIconSpacing

[2017-08-16 20:38:42 - apps] ERROR: In <declare-styleable> MenuView, unable to find attributeandroid:preserveIconSpacing

解決方案:

第一種方法:首先找到appcompat_v7項目包==》res檔案夾==》values檔案夾==》attrs.xml檔案搜尋android:preserveIconSpacing

把name="android:preserveIconSpacing"的attr标簽注釋掉或者删除。

第二種方法:在整個項目中,進行全局搜尋(快捷鍵:Ctrl+H)

選擇File Search視圖,并在Containing text中輸入android:preserveIconSpacing

如下圖所示:

Android出現In &lt;declare-styleable&gt; MenuView, unable to find attribute android:preserveIconSpacing錯誤資訊

會出現如下結果圖:

Android出現In &lt;declare-styleable&gt; MenuView, unable to find attribute android:preserveIconSpacing錯誤資訊

對上面的結果進行輕按兩下進入,然後就可以找到此标簽

并對标簽進行注釋,如下圖所示:

Android出現In &lt;declare-styleable&gt; MenuView, unable to find attribute android:preserveIconSpacing錯誤資訊

然後就可以看到項目沒有錯誤了。