How to uncheck checked items in Navigation View?

前端 未结 12 1413
夕颜
夕颜 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:42

    Joao's solutions didn't not work for me as totally expected. This would lead to a blank space from unchecked Item View on my Navigation.

    Just make sure to set the view as gone:

    
    
    
    bottomNavigationView.getMenu().findItem(R.id.your_menu_item_id_to_hide).setChecked(true);
        bottomNavigationView.findViewById(R.id.your_menu_item_id_to_hide).setVisibility(View.GONE);
    

    Arsent solution is not necessary in this case.

提交回复
热议问题