简体   繁体   中英

Android navigation app change the icon of listed menus

I have use this code for menu icon but does not displayed in app why? Please help me to to display icon left side of navigation menu list

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:checkableBehavior="single">
        <item
            android:id="@+id/income"
            android:icon="@drawable/ic_income"
            android:title="Income" />
        <item
            android:id="@+id/expense"
            android:icon="@drawable/ic_expense"
            android:title="Expense" />
        <item
            android:id="@+id/nav_settings"
            android:icon="@drawable/ic_setting"
            android:title="@string/nav_settings" />
    </group>
</menu>

We have to set icon list as null then only it display the icon in navigation menu list

For that use following this code

navigationView.setItemIconTintList(null);

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