Reputation: 305
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?
Upvotes: 3
Views: 1576
Reputation: 393
The selected method doesn't work for me. Resolved it with, 1) add a dummy tab in tabs.xml
<tab
id="@+id/dummy"/>
2) in your mainactivity after bottombar initialization,
BottomBarTab dummy = bottomBar.getTabWithId(R.id.dummy);
dummy.setVisibility(View.GONE);
Upvotes: 0
Reputation: 699
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);
Upvotes: 0
Reputation: 1001
1) You can try other lib, i can recommend this one Ahbottomnavigation But it works not good at Android 7
2) If you need to support Android 7: Google already provided BottomNavigation in Support Library. It's still not perfect, so i created some Extation for it to make more useful.
Upvotes: 1