gpt4 book ai didi

android - 更改 Android 工具栏中 DrawerToggle 的颜色

转载 作者:搜寻专家 更新时间:2023-11-01 07:53:24 25 4
gpt4 key购买 nike

谁能指出为什么我的抽屉开关(动画打开抽屉导航的小汉堡图标)拒绝切换我的颜色?这给我造成了很多停机时间,我似乎无法弄清楚为什么。

这是我的主题 - 抽屉开关采用 disabled_default_text 的颜色。

<style name="Theme.MyApp.NoActionBar" parent="Theme.MyApp.NoActionBar">
<item name="actionBarStyle">@style/Widget.MyApp.ActionBar</item>
<item name="colorAccent">@color/cs7</item>
<item name="colorControlNormal">@color/disabled_default_text</item>
</style>

这是工具栏布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/ab_solid"
android:minHeight="?attr/actionBarSize"
app:theme="@style/MyToolbarTheme"
app:elevation="@dimen/toolbar_elevation"/>

MyToolbarTheme - 我用白色覆盖 colorControlNormal。

<style name="MyToolbarTheme"     parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="background">@drawable/ab_solid</item>
<item name="titleTextStyle">@style/MyTitleStyle</item>
<item name="colorControlNormal">@color/white</item>
</style>

奇怪的是,添加 colorControlNormal 会将溢出菜单的颜色从 disabled_default_text 颜色更改为白色,但抽屉开关不会更改。任何人都可以找出我做错了什么吗?

最佳答案

您可以将drawerArrowStyle添加到您的主题中

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
</style>

并且您可以将您的 MyDrawerArrowToggle 自定义为

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

关于android - 更改 Android 工具栏中 DrawerToggle 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31549053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com