带抽屉颜色变化的Appcombat v7工具栏 [英] Appcombat v7 Toolbar with drawer changing colors
本文介绍了带抽屉颜色变化的Appcombat v7工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在我的应用程序上实现材质设计,我希望能够将抽屉图标的颜色更改为白色,但是我无法实现我想要的功能.
I am implementing material design on my app, and I want to be able to change the color of the drawer icon to white, but I couldnt achieve what I am looking for..
这是我的themes.xml文件:
This is my themes.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="AppTheme.Base" />
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<style name="HeaderBar" parent="AppTheme.Base">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:background">@color/primary</item>
<item name="actionMenuTextColor">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
</style>
<style name="ActionBarPopupThemeOverlay" parent="ThemeOverlay.AppCompat.Light">
<item name="android:background">@android:color/white</item>
<item name="android:textColor">#000</item>
</style>
<style name="ActionBarThemeOverlay" parent="">
<item name="android:textColorPrimary">#fff</item>
<item name="colorControlNormal">#fff</item>
<item name="colorControlHighlight">#3fff</item>
</style>
</resources>
这是我的toolbar.xml文件
And this is my toolbar.xml file
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/jpe.serviguide.commobile"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ActionBarPopupThemeOverlay"
app:theme="@style/HeaderBar" />
我想要的所有颜色都很好,但是抽屉图标是黑色而不是白色.
All the colors that I wanted are just fine, but the drawer icon is black instead of white..
我尝试了很多事情,但没有结果
I have tried a lot of thing but with no desire result
非常感谢您
推荐答案
最后通过在我的theme.xml文件中完成此操作
Finally made it by doing this on my theme.xml file
<style name="AppTheme" parent="Theme.AppCompat.Light">
....
<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>
这篇关于带抽屉颜色变化的Appcombat v7工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文