Search code examples
androidandroiddesignsupportnavigationview

Checked state for icon is wrong in NavigationView after closing and opening drawer


I have tried implementing the new NavigationView from the Android Support Design library. The app consists of a a DrawerLayout with Fragment holding a NavigationView. A simple menu with icons.

  1. I'm starting the app with no items checked.

  2. I then click on an item the item gets checked, and both text and icon shows checked state:

  3. I then open and close the drawer by swiping. What happens now is that the text for my selected item shows selected state, but the icon does not. On the other hand the item above has the icon showing checked state.

Is this a bug or have I done something wrong?

I project with app screenshots can be viewed here:

https://bitbucket.org/adirdal/navigationviewtest


Solution

  • Solution is to put the NavigationView directly into the DrawerLayout, not inside a Fragment.