NavigationView(Change Color of Selected Item)

create a selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@color/primary" android:state_checked="true" />
        <item android:drawable="@android:color/transparent" />
</selector>

and set

app:itemBackground="@drawable/nav_view_item_background"

then the selected item will be highlighted.

if you want to change the text color then set

app:itemTextColor="@drawable/nav_view_item_textcolor"

and create a selector for it like

<selector xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:color="@android:color/white" android:state_checked="true" />
     <item android:color="@color/primary" />
</selector>

Note : Yasoda's answer not worked for me, which is true in most of the cases.

Though I set the state_checked is true and give it a drawable color, it seems the item is never checked.

For more search, I found the issue was happened with menu item. I hadn't given checked item to true in menu item in menu file.

Then I have to add a tag android:checkable=true to it.

and it works like charm.