2012-07-21 79 views
0

我想爲我的android應用程序做一個簡單的菜單。但是不知道爲什麼,我在我的menu.xml文件的文件收到以下錯誤:Android:Menu.xml錯誤:沒有資源匹配給定的名稱

[2012-07-21 11:53:27 - Torchit] W/ResourceType(5469): Bad XML block: header size 46936 or total size 163847776 is larger than data size 0 
[2012-07-21 11:53:27 - Torchit] /home/tigerstyle/workspace/Torchit/res/menu/menu.xml:2: error: Error: No resource found that matches the given name (at 'id' with value '@id/menu_item_about'). 

的menu.xml文件代碼如下:

<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:id="@id/menu_item_about" 
     android:title="About" 
     android:icon="@drawable/menu_about" /> 
</menu> 

回答

6

您需要添加一個「+」在這樣的「@」之後

<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:id="@+id/menu_item_about" 
     android:title="About" 
     android:icon="@drawable/menu_about" /> 
</menu> 

如果沒有這樣的情況,它會查找已經用該id定義的資源。

+0

Ohh好的..謝謝@Srikanth – Amyth 2012-07-21 06:38:59

相關問題