0

i'm trying to change the tint of each icon in a navigation drawer individually with no success. I have tried :

<item
            android:id="@+id/nav_contacts"
            android:icon="@drawable/ic_emergency"
            app:itemIconTint="@color/colorPrimary"
            android:title="@string/emergency_contacts" />

which does not work, any ideas ?

Zaid Kajee
  • 712
  • 4
  • 9
  • 22

1 Answers1

2

you can set like this:

navigationView.getMenu()
    .findItem(R.id. navigation_item_1)
    .getIcon()
    .setColorFilter(Color.parseColor("#b69260"), PorterDuff.Mode.SRC_ATOP);
Sagar Chavada
  • 5,169
  • 7
  • 40
  • 67
  • Thanks. Icon has been changed but for title I have used Html text to get desired color. Is there different way to change text color too? – nitinkumarp Mar 27 '18 at 06:47
  • @nitinkumarp see this: https://stackoverflow.com/questions/30594025/how-to-customize-item-background-and-item-text-color-inside-navigationview?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Sagar Chavada Mar 27 '18 at 06:50