How to uncheck checked items in Navigation View?

前端 未结 12 1406
夕颜
夕颜 2020-12-15 15:48

I know it\'s possible to highlight a navigation view item by calling setCheckedItem() or return true value in onNavigationItemSelected to display t

12条回答
  •  眼角桃花
    2020-12-15 16:36

    Quoting @Codeversed, there is "no need to loop menu items with added overhead!". But, there is no need to create multiple groups (in this case he is creating the @+id/grp1 and @+id/grp2) to uncheck a previous checked item.

    You can simple add a single group for all elements with the android:checkableBehavior, like this:

    
        
    
        
    
    

提交回复
热议问题