Android drawable ic_menu_star not working?

I am developing 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 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 checked the android resources in my project and it is there. I am building my project on the Android 2.1 platform. This is mistake?

+4
source share
2 answers

Some drawings in the Android package are not declared public and cannot be specified in this way.

The only way to use this feature is to copy it into your own accessible directory and point there.

Change Google has since added an action bar icon to the Android developer site .

+8
source

The best way to find the default in Android Studio and right-click on a folder with the ability to transfer β†’ Create β†’ Image object and perform actions, most likely the asset is located in "ClipArt", enter image description here

+3
source

Source: https://habr.com/ru/post/903099/


All Articles