17

When I try to change navigation drawer toggle color, only hamburger changes it, arrow keeps her native color. You can see it here -enter image description here

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/app_background</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListViewStyle</item>
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="android:textColor">@color/primary_text</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@android:color/holo_red_dark</item>
</style>

If I change parent theme to Theme.AppCompat.Light arrow changes her color to black. The following widget are used: android.support.v7.app.ActionBarDrawerToggle; android.support.v7.widget.Toolbar;

What am I doing wrong?

ATRS
  • 247
  • 4
  • 15
Vladimir K.
  • 653
  • 1
  • 5
  • 14
  • Possible duplicate of [Color of animated ActionBarDrawerToggle in ActionBar](http://stackoverflow.com/questions/27250915/color-of-animated-actionbardrawertoggle-in-actionbar) – Sanf0rd Oct 22 '16 at 02:04
  • I have answered how to do it programmatically on another question(http://stackoverflow.com/questions/27250915/color-of-animated-actionbardrawertoggle-in-actionbar/40164200#40164200). Please mark this question as duplicate. – Sanf0rd Oct 22 '16 at 02:04

4 Answers4

16

This worked for me:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            mDrawerToggle.getDrawerArrowDrawable().setColor(getColor(R.color.drawer_toggle_color));
        } else {
            mDrawerToggle.getDrawerArrowDrawable().setColor(getResources().getColor(R.color.drawer_toggle_color));
        }
Golan Shay
  • 1,250
  • 18
  • 15
  • You can use drawerToggle.drawerArrowDrawable.color = ContextCompat.getColor(this, R.color.white) to avoid the version checking – amitavk Dec 28 '18 at 20:10
11

Try using

        <item name="colorControlNormal">@color/your_color</item>
        <item name="android:colorControlNormal">@color/your_color</item>

instead of your drawer arrow style.

To clear out my comment, try also:

    <item name="actionBarStyle">@style/My.ActionBar.Style</item>

and then:

     <style name="My.ActionBar.Style" parent="Widget.AppCompat.ActionBar">

        <item name="colorControlNormal">@color/your_color</item>
        <item name="android:colorControlNormal">@color/your_color</item>

    </style>
natario
  • 24,954
  • 17
  • 88
  • 158
  • Arrow changed her color to white. Magic. – Vladimir K. Jan 09 '15 at 14:36
  • This used to work with me. Try pasting it into a `@style/Your.Custom.ActionBar.Style` – natario Jan 09 '15 at 14:38
  • I finally noticed that `colorControlNormal` works only if you use the arrow icon provided into the SDK with the support library (namely, `@drawable/abc_ic_ab_back_mtrl_am_alpha`). It won't work if you import the icon from elsewhere, because appcompat only tints its own drawables. If you want to use a different icon, then you can't tint it via style. – natario Feb 17 '15 at 15:01
7

Try this one to change color of DrawerArrow

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@android:color/white</item>
</style>
Anand Savjani
  • 2,484
  • 3
  • 26
  • 39
-2

You could set custom arrow or other icon using the method

toolbar.setNavigationIcon(Int drawable resource);
Oleg Osipenko
  • 2,409
  • 1
  • 20
  • 28