Do not allow user to click on one of the tabs
Just improved answer of @ZeroOne:
private void disableTab(int tabNumber)
{
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
ViewGroup vgTab = (ViewGroup) vg.getChildAt(tabNumber);
vgTab.setEnabled(false);
}
this what i do when to enable or disable tab or customize tab.
//get tab view
ViewGroup vg = (ViewGroup) tab_event.getChildAt(0);
//get number of tab
int tabsCount = vg.getChildCount();
//loop the tab
for (int j = 0; j < tabsCount; j++) {
//get view of selected tab
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
if(j==DESIRED_POSITION){
//disable the selected tab
vgTab.setEnable(false);
}
}
if you attach with viewpager, you need to disable the swipe of the viewpager. If not, you still can swipe to the disable tab.