简体   繁体   中英

android navigation drawer icon tint of single item

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 ?

you can set like this:

navigationView.getMenu()
    .findItem(R.id. navigation_item_1)
    .getIcon()
    .setColorFilter(Color.parseColor("#b69260"), PorterDuff.Mode.SRC_ATOP);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM