Ori Seri
Ori Seri

Reputation: 967

Change the action bar settings icon color

How can one change the color of the overflow icon in the action bar?

enter image description here

(The most right icon)

Upvotes: 30

Views: 57817

Answers (6)

Karem Mohamed
Karem Mohamed

Reputation: 379

if you are using action bar use :

        toolbar.getOverflowIcon().setColorFilter(Color.WHITE , PorterDuff.Mode.SRC_ATOP);

Upvotes: 14

Alex Chengalan
Alex Chengalan

Reputation: 8281

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 actionBar color @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 refer this one inside your application tag.

    android:theme="@style/CustomActionBarTheme"

Upvotes: 35

sanjay kumar
sanjay kumar

Reputation: 33

Create below style in styles.xml with parent as ActionButton Overflow widget and then use that theme in the style that you are using for that activity where toolbar is shown.

Step-1) Creating style for the actionButtonOverflow

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

Step-2) Using this style in the activity that is using actionBar

<style name="CustomMainActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="actionOverflowButtonStyle">@style/DotsDarkTheme</item>
</style>

Upvotes: -1

Mike Birkhoff
Mike Birkhoff

Reputation: 515

If you just want to change the color you can simply tint 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>

Upvotes: 23

Leon
Leon

Reputation: 3726

It's also worth adding that if you simply want to change the overflow button to a light or dark colour to go with your action bar colour this can be done without specifying a custom icon.

For a dark button colour set your theme as:

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

Theme.Holo.Light

For a light button colour add 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 want a light button colour 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>

Upvotes: 2

Jainendra
Jainendra

Reputation: 25143

You can use your custom style inside for menu item, like this

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

Define the style like this:

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

Also see Change the background color of the options menu and

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

Upvotes: 0

Related Questions