简体   繁体   中英

Change color of of menu drawer hamburger icon in Android

I would like to change the icon color from of the hamburger icon. I tried a lots things and nothing worked. Here my XML :

<androidx.appcompat.widget.Toolbar
 android:layout_width="match_parent"
 android:layout_height="?attr/actionBarSize"
 android:background="@color/colorPrimary"
 app:titleTextColor="@color/colorPrimaryDark"
 android:id="@+id/toolbar"
 android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
 app:popupTheme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
 android:elevation="4dp"/>

In styles.xml I have

<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>
  <item name="android:windowDrawsSystemBarBackgrounds">true</item>
  <item name="android:statusBarColor">@android:color/transparent</item>
</style>

Looks like you are using AppCompat. Please create this or similar style:

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="color">#D81B60</item>
</style>

Then use it in your theme:

<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM