Unfortunately the other question wasn't answered about how to hide a Tab in android.support.design.widget.TabLayout.
The others questions are made with TabHost, I don't want to change my code.
I would like to hide the tab "Three".

Fragment:
viewPager = (ViewPager) rootView.findViewById(R.id.search_viewPager);
viewPager.addOnPageChangeListener(viewPagerListener);
viewPager.setAdapter(adapter);
tabLayout = (TabLayout) rootView.findViewById(R.id.search_tabs);
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
tabLayout.setupWithViewPager(viewPager);
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
    <android.support.design.widget.TabLayout
    android:id="@+id/search_tabs"
    style="@style/TabLayoutStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:elevation="1dp" />
    <android.support.v4.view.ViewPager
    android:id="@+id/search_viewPager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true" />
</LinearLayout>
                I suggest you to use code below
var tabLayout = FindViewById<TabLayout>(YOUR_TAB_LAYOUT_ID);
tabLayout.SetupWithViewPager(YOUR_CUSTOM_VIEWPAGER);
**tabLayout.GetTabAt(0).View.Visibility = ViewStates.Gone;**
For making it happen, just insert dummy tab to index 0. You can do it in your custom viewpager adapter. Here is code.
adapter.addFragment(Fragmetn.NewInstance(), "none");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With