Android: unable to change color of back arrow navigation icon

我与影子孤独终老i 提交于 2019-12-05 13:13:11

Just do this in your Activity/Fragment:

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);
Sasha

The path to the right solution for the problem I found here

However this still didn't 100% work due to our use of DrawerLayout. My colleague wrote an excellent post on the solution here

I am also not able to update back arrow button after upgrading to 23.2.0 support library

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

It is the color of actionMenuTextColor. Add this line to your theme.

<item name="actionMenuTextColor">your color</item>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!