Android的绘制ic_menu_star不工作?工作、Android、ic_menu_star

2023-09-07 11:46:56 作者:他入她心毁我心

我设计的菜单中的XML:

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>

当我尝试使用android drawbale ic_menu_star我的日食会引发错误:

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').

我检查了Android资源在我的项目,它是在那里。我建立我的项目上了Android 2.1框架。这是一个错误?

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?

推荐答案

在Android包中的一些可绘制不声明为public,并且不能以这种方式引用。

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.

修改:谷歌此后加入的操作栏图标包到的 Android开发者网站。

Edit: Google have since added a pack of action bar icons to the Android Developer site.