Android how to hide tab from TabLayout

I need to hide the first tab. The first page should work, but when the user selects it, it should look like tabs. How can i do this?

I found some solutions with TabHost and it is useless to me.

public class TabFragmentClients extends Fragment { public static TabLayout tabLayout; public static ViewPager viewPager; public static int int_items = 5 ; FinanceClients FinanceClients; public ClientsFragment clientsFragment; public FinanceFragment financeFragment; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /** *Inflate tab_layout and setup Views. */ final View x = inflater.inflate(R.layout.tab_layout_clients,null); tabLayout = (TabLayout) x.findViewById(R.id.tabs); viewPager = (ViewPager) x.findViewById(R.id.viewpager); /** *Set an Apater for the View Pager */ viewPager.setAdapter(new MyAdapter(getChildFragmentManager())); /** * Now , this is a workaround , * The setupWithViewPager dose't works without the runnable . * Maybe a Support Library Bug . */ tabLayout.post(new Runnable() { @Override public void run() { tabLayout.setupWithViewPager(viewPager); } }); return x; } 
+5
source share
1 answer

Have you tried this?

  tabLayout.setupWithViewPager(viewPager); tabLayout.removeTabAt(0); 
0
source

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


All Articles