I want to hide a menu item of BottomNavigationView dynamically based on some conditions. I tried the following but it is not working.
mBottomNavigationView.g
Try this:
navView.getMenu().findItem(R.id.your_menu_item_id).setVisible(true);
navView.getMenu().findItem(R.id.your_menu_item_id).setVisible(false);
In Kotlin you can use this line of code:
mainActivitbinding.bottomNav.menu.removeItem(R.id.watch_list_tab)
I tried most of solutions but this worked for me,
For hiding an item dynamically :
bottomNavigationView.findViewById(R.id.xyz).setVisibility(View.GONE);
For making item visible:
bottomNavigationView.findViewById(R.id.xyz).setVisibility(View.VISIBLE);