导航抽屉的汉堡图标颜色没有变化。它默认为黑色。我想把它改成@ color / gold。它适用于21以下的API。请帮助我。
这是我正在使用的风格。
<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>
感谢钢铁侠
更改了整个主题
<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>
答案 0 :(得分:2)
在styles.xml中创建样式并输入以下代码
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@android:color/white</item>
</style>
然后像这样添加主题:
< item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
答案 1 :(得分:0)
你可以在下面给出你的图标的色彩
Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_menu, null);
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, Color.GOLD);
actionBar.setHomeAsUpIndicator(drawable);
答案 2 :(得分:0)
非常简单,只需编程即可,只需在下面的代码行中添加...
actionBarDrawerToggle.getDrawerArrowDrawable()
.setColor(getResources().getColor(R.color.white));
完成!
答案 3 :(得分:0)
将此代码写入您的值/样式
<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>