4

Hamburger icon color of navigation drawer is not changing. Its black by default. I want to change it to @color/gold. its working for API below 21. Please help me.

here is the style i am using.

<style name="AppTheme.NoActionBar" >
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionBar">false</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="windowNoTitle">true</item>
    <item name="android:textColorPrimary">@color/gold</item>
    <item name="actionMenuTextColor">@color/gold</item>
    <item name="android:actionMenuTextColor">@color/gold</item>
    <item name="colorControlNormal">@color/gold</item>
</style>

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

</style>

Answer thanks to Iron man

changed the entire theme

  <style name="MyMaterialTheme" parent="MyMaterialTheme.Base">

</style>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar" >
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColorSecondary">@color/booking</item>
    <item name="windowActionBar">false</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="windowNoTitle">true</item>
    <item name="android:textColorPrimary">@color/booking</item>
    <item name="actionMenuTextColor">@color/booking</item>
    <item name="android:actionMenuTextColor">@color/booking</item>
    <item name="colorControlNormal">@color/booking</item>
</style>

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

</style>
Sreepulari
  • 105
  • 1
  • 10
  • Possible duplicate of [How do I change the color of the ActionBar hamburger icon?](http://stackoverflow.com/questions/30760807/how-do-i-change-the-color-of-the-actionbar-hamburger-icon) – Satan Pandeya Dec 14 '16 at 06:04

4 Answers4

4

Create style in your styles.xml and put the following code

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

And then add the theme like so:

< item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
Rajakumar
  • 907
  • 1
  • 7
  • 17
0

you can give tint color of your icon below way

Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_menu, null);
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, Color.GOLD);
actionBar.setHomeAsUpIndicator(drawable);
Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
0

Pretty simple, programmatically you just need to add below line of code...

actionBarDrawerToggle.getDrawerArrowDrawable()
                     .setColor(getResources().getColor(R.color.white));

Done!

Nikunj
  • 3,937
  • 19
  • 33
Ali Nawaz
  • 2,016
  • 20
  • 30
0

write this code into your values/style

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:textColorPrimary">@color/white</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>

</style>

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