0

I have an app that features a grid view. For each item in the grid view I want to provide a context menu, much like you see on the play store

I would like to use the built in android menu icon, but I can't find it anywhere in android.R.drawable, like one might expect it to be. Where, therefore, can I find the icon so I can set it as a drawable in my grid view item.

According to Dmags' answer to this question Google advises that

you should not reference these icons using the Android platform resource IDs (i.e. menu icons >under android.R.drawable).

(though the page linked no longer appears to contain this warning)

I am puzzled as to why this advice would be given? I would want the design to be consistent with the OS it is running on. If Android 5 decides to have an image of a lemon to display the menu, I'd want my app to also use the same image of a lemon to show sub menus.

So can anybody either give me a good reason as to why I should be creating my own graphic rather than use the default Android graphic, or give me the location in which the menu graphic can be found?

LairdPleng
  • 948
  • 3
  • 9
  • 28

1 Answers1

0

Have a look at your android-sdk folder: C:\Program Files\android\sdk\platforms\android-18\data\res\drawable-hdpi\ic_menu_moreoverflow_normal_holo_light.png

I think this might be the one you are looking for.

It is not a good practice to use drawable direct from @android:... because android is an open-source platform and every customer (like Samsung or the cyanogen mod crew) can build their own version of it without the drawable u are using. so you can get a null pointer exception. The better way is to copy the drawable from the android sdk directly into your project.

PlusInfosys
  • 3,416
  • 1
  • 19
  • 33
A.S.
  • 4,574
  • 3
  • 26
  • 43
  • wouldn't it break the entire OS though, if the menu icon wasn't included in a build? – LairdPleng Oct 08 '13 at 02:31
  • if I wanted to use this drawable directly, how would I go about it? contextget.Resources().getDrawable(android.R.drawable.xxxx) doesn't contain ic_menu_moreovrflow. – LairdPleng Oct 08 '13 at 02:38
  • Please copy it, some drawables are private! And could you mark my answer as right and give a upvote. – A.S. Oct 08 '13 at 05:07