Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:无法更改后向箭头导航图标的颜色_Android_Android 5.0 Lollipop_Android Appcompat_Android Toolbar - Fatal编程技术网

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

Android:无法更改后向箭头导航图标的颜色,android,android-5.0-lollipop,android-appcompat,android-toolbar,Android,Android 5.0 Lollipop,Android Appcompat,Android Toolbar,我正在使用新的android appcompat工具栏。我需要为汉堡图标和后箭头图标设置相同的自定义颜色。使用DroperaRowStyle可以更改汉堡图标,但不能更改箭头。问题只是在棒棒糖设备上,任何棒棒糖前的东西都可以 代码如下: 工具栏: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/

我正在使用新的android appcompat工具栏。我需要为汉堡图标和后箭头图标设置相同的自定义颜色。使用DroperaRowStyle可以更改汉堡图标,但不能更改箭头。问题只是在棒棒糖设备上,任何棒棒糖前的东西都可以

代码如下:

工具栏:

<?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" />


但它不起作用。有人有什么想法吗

为我找到的问题找到正确解决方案的途径


然而,由于我们使用了抽屉布局,这仍然没有100%起作用。我的同事在解决方案上写了一篇精彩的帖子

在你的活动/片段中做到这一点:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha, null));
        else
            getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha));

   getSupportActionBar().setDisplayHomeAsUpEnabled(true);

升级到23.2.0支持库后,我也无法更新后退箭头按钮

<style name="ThemeOverlay.MyApp.ActionBar" parent="ThemeOverlay.AppCompat.ActionBar">
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/white</item>
    </style>

@颜色/白色
@颜色/白色

它是actionMenuTextColor的颜色。将这一行添加到主题中

<item name="actionMenuTextColor">your color</item>
你的颜色

Great link的可能复制品,我只需自己更改主题即可正确设置,但这就引出了一个问题,即当使用抽屉时,它会对抽屉产生有趣的效果。
<item name="actionMenuTextColor">your color</item>