在Android中更改菜单抽屉汉堡包图标的颜色

时间:2020-02-20 13:01:47

标签: android colors

我想更改汉堡图标的图标颜色。我尝试了很多事情,但没有任何效果。这是我的 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"/>

styles.xml 中,我有

<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>

1 个答案:

答案 0 :(得分:0)

好像您正在使用AppCompat。请创建此样式或类似样式:

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

然后在您的主题中使用它:

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