Hide Tab in Tablayout Android

modify the adaterList you pass to the viewpager: delete the third element "Three", so it will disappear

EDIT

when the third tab should appear, simply update adapterList/viewPager. You can have some ideas studying this


If you want to save the previous view(if you used any custom view inside tab item):

View view=tab_layout.getTabAt(3).getCustomView();

Then to remove the tab at index idx(say index 2):

tab_layout.removeTabAt(idx);

Then to restore that tab, use:

tab_layout.addTab(tab_layout.newTab().setCustomView(view));

 //To hide the first tab 
 ((ViewGroup) tabLayout.getChildAt(0)).getChildAt(0).setVisibility(View.GONE);
 //Set the next  tab as selected tab
 TabLayout.Tab tab = tabLayout.getTabAt(1);
 tab.select(); 

You can access the TabView of a TabLayout through tablayout.getTabAt(int index) and cast it as LinearLayout so you can set it's visibility to GONE

((LinearLayout) tabLayout.getTabAt(0).view).setVisibility(View.GONE);