Totti
Totti

Reputation: 675

android set exit icon to item menu

i have a menu contains of one item (item to exit application), i want to set an icon to that item, i am working like this (exit is the name of my icon);

<item android:id="@+id/bexitMenuExit"
        android:title="Exit"
        android:alphabeticShortcut="@drawable/exit"
        android:icon="@android:drawable/ic_menu_preferences"
        ></item>

but i didn't got the icon on the item, and i didn't find android:icon for exit, i found for help, setting ... , but not for exti

Upvotes: 1

Views: 7644

Answers (5)

Praveenkumar
Praveenkumar

Reputation: 24506

If it doesn't work means - Push a own exit icon to your project drawable's any of folder and use like below code for your icon

android:icon="@drawable/youriconname"

Otherwise try this icon -

Image

If you want to use above icon. Like this code

<item android:id="@+id/bexitMenuExit"
      android:icon="@android:drawable/ic_menu_close_clear_cancel"
      android:title="Exit"/>

And have a look at Android Drawables you can find lot of android icons.

Upvotes: 9

Chris K.
Chris K.

Reputation: 258

Just answering didn't found any exit button icon part, Google asset-studio is a great place where you can find the most used android icons, or even better generate your own icons in all drawable analysis for several themes.

Upvotes: 0

Kosh
Kosh

Reputation: 6334

easy just do like this or copy it, make sure you have the icon named as (exit)

    android:title="Exit" android:icon="@drawable/exit"/>

Upvotes: 0

Mitchell
Mitchell

Reputation: 929

I believe what you're looking for is:

@drawable/ic_menu_prefrences

This is what I would try:

<item android:id="@+id/bexitMenuExit"
    android:title="Exit"
    android:alphabeticShortcut=""
    android:icon="@drawable/exit"
    ></item>

Upvotes: 2

Mohsin Naeem
Mohsin Naeem

Reputation: 12642

you are looking for something like this android:icon="@android:drawable/ic_menu_close_clear_cancel"

Upvotes: 1

Related Questions