Where are all the standard Android icon resources?

JavaAndroid

Java Problem Overview


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:\Users\Dan\workspace\TweetTab\res\menu\options_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.

Java Solutions


Solution 1 - Java

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

Solution 2 - Java

I installed the Android SDK for Eclipse on Windows.

Now I can find all ressources under "C:\Program Files\Android\android-sdk-windows\platforms\android-9\data\res..."

Solution 3 - Java

it is now possible to use vector assets to generate standard (or customised) icons for android.

  • Add 'com.android.tools.build:gradle:1.4.0-beta3' to your build.gradle file. (The stable version will be out in the coming weeks).
  • Add a vector asset by right-clicking res/drawable/ > New > Vector Asset. Android Studio provides a built-in viewer for you to pick your drawable.
  • Reference your icon like you usually do. Eg: android:icon="@drawable/ic_help_24dp"

Solution 4 - Java

try this instead:

         android:src="@android:drawable/ic_menu_camera"

Solution 5 - Java

A lot of them can be found in android.R.drawable but not all are publicly accessible

Solution 6 - Java

You can find the android.R.drawable images in your local SDK folder. (Tested using Android Studio 3.0)

First have a look at the docs for the names of the drawables here: https://developer.android.com/reference/android/R.drawable.html

Second either search your drive for one of those image names.png or type in the name of any of them into your Android Studio activity and right click (goto declaration) on it to view the image. Then you can also right click that image to copy the path. Then open that folder and look at all the PNG's there.

Example on windows 10: android.R.drawable.star_big_on is located in user/AppData/Local/Android/Sdk/platforms/android-25/data/res/drawable-hdpi/star_big_on.png

(Note also on windows AppData is a hidden folder so you may need to set your windows explorer to show hidden if you are clicking to open each folder)

Also if you need to see material design icons / descriptions this is a good place to look: https://material.io/icons

Solution 7 - Java

Someone may see this page useful for getting those icons... http://developer.android.com/design/style/iconography.html

Solution 8 - Java

For those of you in the Visual Studio/Xamarin Android camp, you can view and add the standard Material icons pretty easily using the following plugin:

https://marketplace.visualstudio.com/items?itemName=nikainteristi.Materialiconsgenerator

I've used it a few times in my projects.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjcvandanView Question on Stackoverflow
Solution 1 - JavaSalwView Answer on Stackoverflow
Solution 2 - JavaJackView Answer on Stackoverflow
Solution 3 - JavaAngel KohView Answer on Stackoverflow
Solution 4 - Javaprincewiki khanView Answer on Stackoverflow
Solution 5 - JavaKurruView Answer on Stackoverflow
Solution 6 - JavaDeemoeView Answer on Stackoverflow
Solution 7 - JavaCarlos Perez PerezView Answer on Stackoverflow
Solution 8 - JavaBondolinView Answer on Stackoverflow