20

How do i change the Overflow Menu icon on the far right of the action bar as seen in the image below? My Holo theme specifies this 3 row black stack icon by default and i want something else. i can't seem to find a solution for this. I have looked at the documentation on http://developer.android.com/guide/topics/ui/menus.html but it doesn't seem to lend much help.

Thanks!

"ActionBar"

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
newdev
  • 1,363
  • 1
  • 12
  • 18
  • Please leave that icon alone. Time and time again, users attack developers who do not adhere to basic platform conventions. Unless you can positively demonstrate that your users will reject your application if you do *not* change that icon, please leave that icon alone. That being said, I do not see where that icon can be changed, anyway. – CommonsWare Jul 22 '11 at 17:09
  • 2
    The only reason i wanted to change that icon is to make it white instead of black. My actionbar background is very dark in that area and it is almost impossible to see the icon. I am not changing platform conventions or anything dramatic like that :) – newdev Jul 26 '11 at 14:04
  • Ah, sorry, I overreacted. One would think that wherever you are controlling the style for the bar that you could change that icon. I didn't see the icon in the SDK, so I didn't have a search string to try to find it in styles.xml or kin. – CommonsWare Jul 26 '11 at 15:57
  • Googlers, **Check this answer** : http://stackoverflow.com/a/35790470/1911652 – Atul Sep 08 '16 at 19:41

8 Answers8

31

You can try something like this:

<style name="MyTheme" parent="android:style/Theme.Holo.Light">
     <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>

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

and in AndroidManifest.xml

<application
    android:theme="@style/MyTheme" >
intra
  • 705
  • 10
  • 9
20

Define a custom style: for example, let's call it customoverflow.

In this style you set android:src to the picture you would like to use. Now create a style with parent Theme.holo.

In this style you need to define:

<item name="android:actionOverflowButtonStyle">@style/customoverflow</item>

I just tested this and it works.

Xenon
  • 3,174
  • 18
  • 37
KarlKarlsom
  • 5,868
  • 4
  • 29
  • 36
10

If you are using AppCompat you can achieve by following code.

res/values/themes.xml

<style name="MyTheme" parent="@style/Theme.AppCompat.Light">
     <item name="android:actionOverflowButtonStyle">@style/ActionButtonOverflow</item>

      <!-- Support library compatibility -->
     <item name="actionOverflowButtonStyle">@style/ActionButtonOverflow</item>

</style>

      <style name="ActionButtonOverflow" parent="@style/Widget.AppCompat.ActionButton.Overflow">
            <item name="android:src">@drawable/ic_launcher</item>
        </style>

and in androidmanifest.xml

<application
    android:theme="@style/MyTheme" >
Sufian Latif
  • 13,086
  • 3
  • 33
  • 70
DjP
  • 4,537
  • 2
  • 25
  • 34
3

I noticed that it becomes white if the theme of the app is Holo, but it is blackish when the theme is Holo.Light

However, changing the style of the action bar to inherit from Holo and the rest of the app from Holo.Light does not solve the problem, but it should point in the direction of which style you should be modifying.

What I have tried is:

<style name="AppThemeLight" parent="android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/ActionBar</item>
    <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
</style>    
<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@color/header_brown</item>
    <item name="android:titleTextStyle">@style/ActionBarTitle</item>
    <item name="android:icon">@drawable/header</item>       
</style>

I have the same problem and I think this is close to a solution

shalafi
  • 3,926
  • 2
  • 23
  • 27
1

Duplicate question, Changing overflow icon in the action bar

This is my answer as below,

  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.@.@

Community
  • 1
  • 1
Luna Kong
  • 3,065
  • 25
  • 20
0

Shalafi's solution works with a few changes! You will need to specifiy theme.Holo as the parent for the theme but it has the downside of changing the default text color(at least in my styles).

The amended code should be:

   <style name="AppThemeLight" parent="android:style/Theme.Holo">
    <item name="android:actionBarStyle">@style/ActionBar</item>
    <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
</style>    
<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@color/header_brown</item>
    <item name="android:titleTextStyle">@style/ActionBarTitle</item>
    <item name="android:icon">@drawable/header</item>       
</style>
Lettings Mall
  • 300
  • 3
  • 10
0

Basically Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go values/styles.xml

Shalafi's solution works with a few additions:So add this code to both res/values-vXX/styles.xml and res/values/styles.xml and this will work like Magic!

<style name="AppTheme" parent="android:style/Theme.Holo.Light">
 <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>

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

also add it in AndroidManifest.xml

<application
    android:theme="@style/AppTheme" >
Abdus Salam
  • 11
  • 10
0
<style name="ToolBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
    <item name="android:tint">@color/colorAccent</item>

create the above theme.set tint with your color and add this theme to the toolbar.

<androidx.appcompat.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        android:theme="@style/ToolBarTheme"/>