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.
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);
You can "wrap" the icon as a drawable (res/drawable) and apply the applicable tint
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_menu_icon"
android:tint="@color/pink"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With