0

I have tried to change the hamburger icon color from black to white following this: How to change Toolbar home icon color, however the icon will not change its color.

Here is the style I created:

<style name="WhiteHamburguerIcon" parent="AppTheme">
        <item name="android:textColorSecondary">@color/white</item>
</style>

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

Then I applied the style to the toolbar:

<android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:theme="@style/WhiteHamburguerIcon"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:titleTextAppearance="@style/Toolbar.TitleText" />

The activity is using this style:

<style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
</style>

The back arrow is white also the overflow button. What can I do to achieve this?

rena
  • 1,223
  • 3
  • 17
  • 30
  • 1
    Is that hamburger icon coming from an `ActionBarDrawerToggle`? If so, you can style it directly, like is shown in the second part of [my answer here](https://stackoverflow.com/a/47131306). Otherwise, you could tint the drawable like is shown in the first part there. – Mike M. Feb 24 '18 at 00:17

2 Answers2

0

parent from your style icon must be "@style/Widget.AppCompat.DrawerArrowToggle". The "WhiteHamburguerIcon" is an item style, so just add it to the activity style:

<item name="drawerArrowStyle">@style/WhiteHamburguerIcon</item>
armen
  • 453
  • 1
  • 4
  • 11
0

I think you should change your "styles.xml" file as

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

</style>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</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/white</item>
</style>

Happy coding...

Rushabh Shah
  • 680
  • 4
  • 22