Change the color of the action bar settings icon

How to change the color of the overflow icon in the action bar?

enter image description here

(The most correct icon)

+21
java android
Apr 16 '13 at 11:46 on
source share
6 answers

You can use 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> 

in your AndroidManifest.xml

 <application android:theme="@style/MyTheme" > 

If you want to change color actionBar @ style / MyActionBar

  <!-- Support library compatibility --> <item name="actionBarStyle">@style/MyActionBar</item> </style> <!-- ActionBar styles --> <style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <item name="android:background">@color/app_theme_color</item> <!-- Support library compatibility --> <item name="background">@color/app_theme_color</item> <item name="android:alwaysDrawnWithCache">true</item> <item name="android:displayOptions">showTitle|showHome|homeAsUp</item> <item name="android:icon">@android:color/transparent</item> </style> 

Then in your AndroidManifest.xml you need to reference this inside the tag of your application .

  android:theme="@style/CustomActionBarTheme" 
+30
Apr 16 '13 at 11:54 on
source share

If you just want to change the color, you can just direct it:

  <style name="DotsDarkTheme" parent="@style/Widget.AppCompat.ActionButton.Overflow" > <item name="android:tint">@color/yourColor</item> </style> 

and then use it in your style:

  <item name="actionOverflowButtonStyle">@style/DotsDarkTheme</item> 
+14
Aug 16 '17 at 12:35 on
source share

It’s also worth adding that if you just want to change the overflow button to light or dark in order to go with your action bar color, you can do this without specifying a custom icon.

For a dark button color, indicate your theme as:

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

Theme.Holo.Light

For the color of the backlit button, add a DarkActionBar:

 <style name="MyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/MyTheme.ActionBar</item> </style> 

Theme.Holo.Light.DarkActionBar

If, like me, you need a light button color, but you want the overflow menu to be light, you can do the following:

 <style name="MyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/MyTheme.ActionBar</item> <item name="android:actionBarWidgetTheme">@style/MyTheme.ActionBarWidget</item> </style> <!-- This helps the PopupMenu stick with Light theme while the ActionBar is in Dark theme --> <style name="MyTheme.ActionBarWidget" parent="android:Theme.Holo.Light"> <item name="android:popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item> <item name="android:dropDownListViewStyle">@android:style/Widget.Holo.Light.ListView.DropDown</item> </style> 
+2
Sep 19 '14 at 10:15
source share

You can use your own style inside a menu item, for example

 <item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item> 

Define the style as follows:

 <style name="myCustomMenuTextApearance" parent="@android:style/TextAppearance.Widget.IconMenu.Item"> <item name="android:textColor">@android:color/primary_text_dark</item> </style> 

Also see Change background color in the options menu and

Android: customize the application menu (e.g. background color)

0
Apr 16 '13 at 11:59
source share

Create the style below in the styles.xml file with the parent element as the ActionButton Overflow widget, and then use this theme in the style that you use for the action where the toolbar is displayed.

Step 1) Creating a Style for actionButtonOverflow

 <style name="DotsDarkTheme" parent="@style/Widget.AppCompat.ActionButton.Overflow" > <item name="android:tint">your color</item> </style> 

Step 2) Using this style in an action that uses an actionBar

 <style name="CustomMainActivityTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="actionOverflowButtonStyle">@style/DotsDarkTheme</item> </style> 
0
Jul 27 '18 at 3:57
source share

if you use the action bar use:

  toolbar.getOverflowIcon().setColorFilter(Color.WHITE , PorterDuff.Mode.SRC_ATOP); 
0
May 24 '19 at 23:42
source share



All Articles