Changing overflow icon in the action bar

AndroidAndroid 3.0-HoneycombAndroid ActionbarAndroid 4.0-Ice-Cream-Sandwich

Android Problem Overview


Is it possible to change the overflow icon in the action bar? I have blue icons for all ActionBar items and I also want to change the overflow icon when it appears.

Android Solutions


Solution 1 - Android

You can with a style, but you have to add it to the main Theme declaration.

<resources>
    <!-- Base application theme. -->
    <style name="Your.Theme" parent="@android:style/Theme.Holo">
        <!-- Pointer to Overflow style ***MUST*** go here or it will not work -->
        <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
    </style>

    <!-- Styles -->
    <style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
        <item name="android:src">@drawable/ic_action_overflow</item>
    </style>

</resources>

You also can change it dynamically, which I go into detail about here:

Changing the Android Overflow menu icon programmatically

Solution 2 - Android

For those who can't get it to work try this WITHOUT the "android:" namespace.

<item name="actionOverflowButtonStyle">@style/OverFlow</item>

Solution 3 - Android

  1. Change your custom overflow icon of Actionbar in styles.xml.

      <resources>
         <!-- Base application theme. -->
         <style name=“MyTheme" parent="@android:style/Theme.Holo">
            <!-- Pointer to Overflow style DONT forget! -->
            <item name="android:actionOverflowButtonStyle">@style/MyOverFlow</item>
         </style>
    
         <!-- Styles -->
         <style name="MyOverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
             <item name="android:src">@drawable/ic_your_action_overflow</item>
         </style>
      </resources>
    
  2. Put custom theme "MyTheme" in application tag of AndroidManifest.xml

     <application
         android:name="com.example.android.MainApp"
         android:theme="@style/AppTheme">
     </application>
    

Have fun.@.@

Solution 4 - Android

No matter what I tried to do in styles.xml, none of the solutions worked for me. In the end, if you have AppCompat 23+, which you should, this is the easiest way that actually works:

toolbar.setOverflowIcon(drawable);

Solution 5 - Android

@adneal's answer is correct (so this is just a community wiki explanation to expand on it).

One of the comments suggested that there may be misunderstanding how to do this, so my answer is just another example on how to override the Overflow icon image.

Code below is based on the template styles from the ADT sample New Android Project. The code comes from the styles.xml file in res/values folder.


<style name="AppBaseTheme" parent="android:Theme.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.

    -->
</style>

<!-- 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/OverflowMenuButton</item>
</style>

<style name="OverflowMenuButton" parent="@android:style/Widget.Holo.ActionButton.Overflow">
    <item name="android:src">@drawable/ic_menu_moreoverflow</item>
</style>

What this above code does is replace the default overflow icon with whatever drawable you have that is named ic_menu_moreoverflow. If you want a quick way to test it out, use your app's launcher icon filename, which will make it obvious how it works.

A useful resource to use when trying to understand ActionBar styling, is:

There you can define specific colours to use for your Overflow icon, and the ZIP file will include the correct styles.xml file for you.

Solution 6 - Android

For Overflow icon color change, you can just add

toolbar.setOverflowicon(getDrawable(R.id.whiteIcon));

or

toolbar.setOverflowicon(getDrawable(R.id.redIcon));

It will change the icon, choose whatever color you want and set as an Overflowicon.

Solution 7 - Android

After long search what i got the guidance to be followed like:

  1. Check the theme in the manifesto file.

  2. Then go to res->values->themes.

  3. Find the theme name in this file .

  4. Add the item within the theme in the theme.xml:

     <item name="android:actionBarWidgetTheme">@style/widgetStyle</item>
     <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
    
  5. Add the icon in the style in the same file I mean theme.xml:

     <style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
     <item name="android:src">@drawable/icon_menu</item>
     </style>
    
  6. Check out the custom icon which you want to change

It worked for me

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpjaneczeView Question on Stackoverflow
Solution 1 - AndroidadnealView Answer on Stackoverflow
Solution 2 - Androiduser2968401View Answer on Stackoverflow
Solution 3 - AndroidLuna KongView Answer on Stackoverflow
Solution 4 - AndroidStarwaveView Answer on Stackoverflow
Solution 5 - AndroidRichard Le MesurierView Answer on Stackoverflow
Solution 6 - AndroidNavin KumarView Answer on Stackoverflow
Solution 7 - AndroidIssac BalajiView Answer on Stackoverflow