2012-07-21 100 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

相关问题