How to set Tint in NavigationView to some icons

diesersamat picture diesersamat · Sep 7, 2015 · Viewed 8.4k times · Source

I want to keep some icons not tinted, and some tinted. Now I have:

app:itemIconTint="@color/menu_icons_selector"

It tints all icons.

I'm trying to make all icons not tinted

mNavigationView.setItemIconTintList(null);

and then

mNavigationView.getMenu().getItem(4).getIcon().setColorFilter(redColor, PorterDuff.Mode.SRC_ATOP);

to set tint only to 4th item, but this not working - all icons are now not tinted, and 4th also not tinted.

Answer

Raveesh G S picture Raveesh G S · Feb 3, 2016

This is working for me.... In this way you can tint individual Navigation MenuItem Icon Color Programmatically

navigation.getMenu().findItem(R.id.navItem1).getIcon().setColorFilter(Color.RED,PorterDuff.Mode.SRC_IN);