2012-11-22 36 views
-2

这是我的菜单式的Android XML没有资源发现错误menu.xml文件

<?xml version="1.0" encoding="utf-8"?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android" > 
    <group android:id="@+id/rose" android:menuCategory="container" android:visible="true"> 
     <item android:icon="@drawable/login.png" android:id="@layout/activity_login_page"></item> 
     <item android:id="@layout/activity_registration__page" android:icon="@drawable/registration.png"></item> 
     <item android:id="@layout/activity_online_shopping" android:icon="@drawable/shopping.png"></item> 
     <item android:id="@layout/activity_your_total_bill" android:icon="@drawable/logout.png"></item> 
    </group> 
</menu> 

这是我发现的错误,但我有资源都在我的文件夹绘制

W/ResourceType(3000): Bad XML block: header size 116 or total size 0 is larger than data size 0 
[2012-11-22 15:32:20 - OrderPlacemnet] E:\workspace\OrderPlacemnet\res\menu\rosemenu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/login.png'). 
[2012-11-22 15:32:20 - OrderPlacemnet] E:\workspace\OrderPlacemnet\res\menu\rosemenu.xml:5: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/registration.png'). 
[2012-11-22 15:32:20 - OrderPlacemnet] E:\workspace\OrderPlacemnet\res\menu\rosemenu.xml:6: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/shopping.png'). 
[2012-11-22 15:32:20 - OrderPlacemnet] E:\workspace\OrderPlacemnet\res\menu\rosemenu.xml:7: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/logout.png'). 

请帮我寻找错误

+0

在eclipse中做一个“干净的项目”可能会解决你的问题。 –

+0

确保你在'res/drawable'文件夹中放置了'logout.png'图像,并从Project-> Clean ...清洁你的项目...在Eclipse IDE –

+0

请尽快回复我任何答案 –

回答

0

您的问题是由.png包含在src标签中的菜单项引起的。你不应该包括它。你的菜单代码应该是这样的:

<?xml version="1.0" encoding="utf-8"?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android" > 
    <group android:id="@+id/rose" android:menuCategory="container" android:visible="true"> 
     <item android:icon="@drawable/login" android:id="@layout/activity_login_page"></item> 
     <item android:id="@layout/activity_registration_page" android:icon="@drawable/registration"></item> 
     <item android:id="@layout/activity_online_shopping" android:icon="@drawable/shopping"></item> 
     <item android:id="@layout/activity_your_total_bill" android:icon="@drawable/logout"></item> 
    </group> 
</menu> 
+0

但我想包括图像的项目,然后什么做...因为每个PNG它产生的错误 –

+0

你正在包括图像。只需从菜单定义中省略'.png'部分即可。构建过程会自动提取它。 –

0

请删除巴纽在你的菜单

<menu xmlns:android="http://schemas.android.com/apk/res/android" > 
    <group android:id="@+id/rose" android:menuCategory="container" android:visible="true"> 
     <item android:icon="@drawable/login" android:id="@layout/activity_login_page"></item> 
     <item android:id="@layout/activity_registration__page" android:icon="@drawable/registration"></item> 
     <item android:id="@layout/activity_online_shopping" android:icon="@drawable/shopping"></item> 
      <item android:id="@layout/activity_your_total_bill" android:icon="@drawable/logout"></item> 
    </group> 



</menu> 
+0

感谢它工作...我从xml删除PNG –

+0

感谢所有专家的帮助.... –

+0

不要忘记接受答案,如果你有解决方案 – raju

相关问题