Tigran Vardanyan Tigran Vardanyan - 6 months ago 94
Android Question

Disable default selected tab

I'm using BottomBar library for Material design Bottom navigation and the problem is that its selecting first item by default and there is no any function or option to disable default selection.

How can I disable default selection?


It seems that BottomBar library adds BOTTOM_BAR_VIEW_ACTIVE tag to first item. So you could create the first item as a dummy item, and then hide it when library finishes loading, you could call:

View oldTab = BottomBar.getRootView().findViewWithTag("BOTTOM_BAR_VIEW_ACTIVE");
if(oldTab != null) oldTab.setVisibility(View.GONE);