I'm designing a menu in XML:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:icon="@android:drawable/ic_menu_preferences" android:title="@string/menu_preferences" android:id="@+id/menu_preferences"/>
<item android:id="@+id/menu_bookmarks" android:title="@string/menu_bookmarks" android:icon="@android:drawable/ic_menu_star"></item>
<item android:title="@string/menu_history" android:id="@+id/menu_history" android:icon="@android:drawable/ic_menu_recent_history"></item>
</menu>
When I try to use the android drawbale ic_menu_star my eclipse throws an error:
[2011-07-06 00:52:28 - Testapp] W/ResourceType( 1852): Bad XML block: header size 51 or total size 3342532 is larger than data size 0
[2011-07-06 00:52:28 - Testapp] C:\eclipseprojects\Testapp\res\menu\search_menu.xml:4: error: Error: Resource is not public. (at 'icon' with value '@android:drawable/ic_menu_star').
I've checked the android resources in my project and it is in there. I'm building my project on the android 2.1 framework. Is this a bug?
Some drawables in the Android package aren't declared as public, and can't be referenced in this way.
The only way to use this drawable is to copy it into your own drawable directory and reference it there.
Edit: Google have since added a pack of action bar icons to the Android Developer site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With