I want to disable clicks on BottomNavigationView when my API results are loading. I have used the code below to disable:
if (bottomNavigationView != null) {
bottomNavigationView.setClickable(!showLoading);
bottomNavigationView.setFocusable(!showLoading);
bottomNavigationView.setEnabled(!showLoading);
if (showLoading) {
bottomNavigationView.setOnNavigationItemSelectedListener(null);
} else {
bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
}
What this does is that it prevents the NavigationItemSelectedListener being called. This is perfectly fine.
Issue is, it still selects the menu item and changes the color as per the selector.
TIA