android - 在Android中更改菜单抽屉汉堡图标的颜色
问题描述
我想更改汉堡图标的图标颜色。我尝试了很多东西,但没有任何效果。这是我的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>
解决方案
看起来您正在使用 AppCompat。请创建此或类似样式:
<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
<item name="color">#D81B60</item>
</style>
然后在你的主题中使用它:
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
推荐阅读
- c - Math equation user input validation
- javascript - 文本到语音音频在浏览器中无法同步工作
- spring - 我们应该在 Hibernate 和 Springboot 中使用什么。SessionFactory 或 EntityManager
- sql - PLS-00312: a positional parameter association may not follow a named association
- .net-core - .Net Core & Entity Framework Core - 使用 Table Per Hierarchy 访问模型中子类的属性
- json - ExtJs:从 Json 响应填充 ComboBox
- javascript - 为什么 Javascript 规范设计者在 promise 中引入了 microtask
- javascript - 将多个参数传递给 jQuery 函数
- html - 有什么方法可以在不查看源代码的情况下从浏览器/编辑器编辑 HTML 页面
- mysql - 如果 Laravel 中的某些字段是可选的,则使用下拉菜单过滤数据