How to change option menu icon in the action bar?

smartmouse picture smartmouse · Oct 10, 2014 · Viewed 103.1k times · Source

How to change the index icon of option menu?

enter image description here

I mean icon (3).

Here is my code:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options, menu);

    return true;
}

And here is the XML file:

<item android:id="@+id/Bugreport"
    android:title="@string/option_bugreport" />

<item android:id="@+id/Info"
    android:title="@string/option_info" />

<item android:id="@+id/About"
    android:title="@string/option_about" />

Answer

Syed Raza Mehdi picture Syed Raza Mehdi · Oct 10, 2014

The following lines should be updated in app -> main -> res -> values -> Styles.xml

 <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>

<!-- Style to replace actionbar overflow icon. set item 'android:actionOverflowButtonStyle' in AppTheme -->
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
    <item name="android:src">@drawable/ic_launcher</item>
    <item name="android:background">?android:attr/actionBarItemBackground</item>
    <item name="android:contentDescription">"Lala"</item>
</style>

This is how it can be done. If you want to change the overflow icon in action bar