更改导航抽屉指示器图标的颜色

Change the color of Navigation Drawer indicator icon

我正在使用工具栏代替操作栏,我也在使用导航 drawer.My 工具栏颜色是黑色,我希望我的导航抽屉指示器颜色是 white.So 如何更改颜色导航抽屉指示器或将自定义导航指示器放入 v7.Can 任何人都可以帮助我吗?

尝试在您的 styles.xml 中创建此样式。

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

然后,将它添加到您的 AppTheme 样式中,如下所示。

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

在您的 AppTheme 中添加此样式。

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<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>

以下对我有用。

 <style name="ToolBarStyle" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="colorControlNormal">@android:color/white</item>
        </style>

将此代码放入您的 activity

toggle.getDrawerArrowDrawable().setColor(getResources().getColor(R.color.grey));

1:转到目录 res -> themes.xml

2:内部:

<style name="Theme.YourAppName" parent="Theme.MaterialComponents.Light.NoActionBar">

添加这一行: <item name="colorControlNormal">@android:color/white</item>

您可以将其添加到 themes.xml (night) 中,也可以根据您喜欢的样式进行更改。