Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create an android menu item using android setting icon

Tags:

android

Can you please tell me how can I create an android menu item using android setting icon?

like image 773
michael Avatar asked Jun 08 '10 17:06

michael


2 Answers

Here is a list of the standard icons. I don't see a "settings" icon. Perhaps you mean "Preferences" (ic_menu_preferences)?

You can set the icon programmatically like this:

menu.add(0, MENU_QUIT, 0, "Quit").setIcon(R.drawable.menu_quit_icon); 

You can also set it in your xml layout like this:

<item android:id="@+id/save_button"       android:icon="@android:drawable/ic_menu_save"       android:title="Save Image"/> 
  • Creating Menus in Android
like image 200
dbyrne Avatar answered Sep 23 '22 23:09

dbyrne


You can see all the icons in the android SDK forder:

_your_install_path_\android-sdk\platforms\android-10\data\res\drawable-hdpi\ 

and then get a reference to them with:

android.R.drawable.ic_menu_preferences 

just like it was your drawable.

like image 20
Kristóf Dombi Avatar answered Sep 25 '22 23:09

Kristóf Dombi