karthik
karthik

Reputation: 219

how to add icon in menu items in action bar android?

My problem is how it is add the icon in menu items in ActionBar android.if we declare the app:showAsAction="never"

My code is

<item android:id="@+id/twitID"
            android:title="twitter"
            android:orderInCategory="100"
            android:icon="@drawable/twitter"
            app:showAsAction="never" />

it show only title. it's not working.please help me. Thank u.

Upvotes: 2

Views: 4487

Answers (1)

tasomaniac
tasomaniac

Reputation: 10342

You should change showAsAction to showAsAction="always" or showAsAction="ifRoom" and it will automatically put your item to the ActionBar as an item with icon.

If you want to show the item in the overflow menu not in the ActionBar as an item, then you should inflate a PopUp manually with custom layout. Then you can put whatever you want. But it is not simplest thing to do.

Upvotes: 3

Related Questions