Hide ViewPager tabs dynamically

I would like to hide tabs in a specific fragment. I have MainActivity and two tabs - fragments (I use viewPager). However, in the third fragment I need to hide these tabs and show only the toolbar.

I know how to hide a toolbar, but nowhere I find how to hide tabs dynamically.

thanks for the help

+4
source share
1 answer
 TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); //your tablayout id

For hide

 tabLayout.setVisibility(View.GONE); // or View.INVISIBLE

To display

tabLayout.setVisibility(View.VISIBLE); 
+4
source

Source: https://habr.com/ru/post/1652028/


All Articles