小编Sas*_*sha的帖子

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

我正在使用新的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 …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat android-5.0-lollipop android-toolbar

5
推荐指数
1
解决办法
1万
查看次数