Android:无法更改后退箭头导航图标的颜色

Sas*_*sha 5 android android-appcompat android-5.0-lollipop android-toolbar

我正在使用新的Android appcompat工具栏.我需要为汉堡图标和后退箭头图标设置相同的自定义颜色.使用drawerArrowStyle允许我更改汉堡图标而不是箭头.问题只出现在Lollipop设备上,任何前棒棒糖都可以.

汉堡包

箭头

这是代码:

工具栏:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/my_primary"
    local:theme="@style/My.Toolbar"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
Run Code Online (Sandbox Code Playgroud)

Style.xml:

<style name="Theme.Base" parent="Theme.AppCompat.Light">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/my_primary</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">@color/black</item>
  </style>

    <style name="My.Theme" parent="Theme.Base">
       <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>

    <style name="My.Toolbar" parent="Theme.AppCompat.NoActionBar">
      <!-- color of the title text in the Toolbar, in the Theme.AppCompat theme:  -->
      <item name="android:textColorPrimary">@color/my_actionbartext</item>

      <!-- necessary to support older Android versions.-->
      <item name="actionMenuTextColor">@color/my_actionbartext</item>

      <item name="android:textColorSecondary">@color/my_actionbartext</item>
    </style>

    <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
            <item name="color">@color/my_actionbartext</item>
    </style> 
Run Code Online (Sandbox Code Playgroud)

我试过从这里使用解决方案,但它没有用.有人有什么想法吗?

Sas*_*sha 1

我在这里找到的问题的正确解决方案的路径

然而,由于我们使用了 DrawerLayout,这仍然没有 100% 有效。我的同事在这里写了一篇关于解决方案的精彩文章