I\'m using a TabLayout
for Tabbed navigation in my app. I have a really weird issue with it, I have created 4 tabs using this code:
private int[
The correct answer for tab selection in TabLayout
would be:
TabLayout.Tab currentTab = mTabs.getTabAt(selectedTab);
if (currentTab != null) {
View customView = currentTab.getCustomView();
if (customView != null) {
customView.setSelected(true);
}
currentTab.select();
}
where currentTab.select()
will move the indicator to the selected tab, when customView.setSelected()
will make all the items in the custom view set their selected states from the selectors look selected.