Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
135 views
in Technique[技术] by (71.8m points)

java - Where are all the standard Android icon resources?

I have just started writing my first ever Java/Android application, so forgive the total n00b question.

How do you access the the standard operating system icons such as search icon/menu icon etc? They are not in the res/drawable folder where I would expect to find them. Are they available as part of the SDK or must you download them seperately?

EDIT

Maybe you can help me further - I am getting the following error (repeated on):

[2011-09-08 19:59:47 - TweetTab] C:UsersDanworkspaceTweetTab
esmenuoptions_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_menu_search').

However, the icon is not empty, the xml looks like this:

<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/search"
        android:icon="@drawable/ic_menu_search"
        android:title="@string/search"/>
</menu>

Am I missing something?

SOLVED

I changed android:icon="@drawable/ic_menu_search" to android:icon="@android:drawable/ic_menu_search" and it could then find the icon.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can acces them via android.R.drawable.* or in xml by @android:drawable/something.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...