1

I am setting the back arrow of the action bar and changing its color like so:

final Drawable upArrow = getResources().getDrawable(R.drawable.ic_action_navigation_arrow_back);
upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);

And as you can see, I am changing the color of the arrow in this line because the default returned arrow is gray, here:

upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);

And the color is changing but the problem that it is a bit transparent although the color white that I am providing has the following hex code #FFFFFFFF.

Here are two images that will make my point clear.

This is how it looks:

This is how it looks

While the color should like this other component:

enter image description here

And I tried all the options that are under PorterDuff.Mode.XXXX but none worked.

priyankvex
  • 5,760
  • 5
  • 28
  • 44
Mohammad Haidar
  • 1,109
  • 1
  • 16
  • 35
  • **Check out this** [Already Have Answer](http://stackoverflow.com/questions/31870132/how-to-change-color-of-hamburger-icon-in-material-design-navigation-drawer) – Abhishek Nov 16 '16 at 11:26
  • @Abhishek no this is not the same issue, because am not asking how to change the color of the item but instead am asking why the color filtering is not giving the required result – Mohammad Haidar Nov 16 '16 at 12:46

2 Answers2

2

plz change in your style.xml

    <style name="MyCustomTheme" parent="Custom.Base">

   </style>

<style name="Custom.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@android:color/white</item>
</style>
Damini Mehra
  • 3,257
  • 3
  • 13
  • 24
1

If you're using Toolbar then add item in your AppTheme.

<item name="colorControlNormal">@color/white</item>

But Make sure that you don´t have another theme defined in your Toolbar element on your layout.

Amol Nage
  • 85
  • 10