How to hide a tab in tablayout
<p>I have a <code>tablayout</code> with about <code>9 tabs</code>. I add tabs like this.</p>

<pre><code>tabLayout.addTab(tabLayout.newTab());
TextView tab = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
tab.setText("TEXT");
tab.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_special_offer, 0, 0);
tabLayout.getTabAt(8).setCustomView(tab);
</code></pre>

<p>we want to <code>disable</code> some of it. I think hiding it would be more efficient than putting validations in every way to access a tab. but I don't know how to hide them. </p>

<p>here's my layout:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;com.flipboard.bottomsheet.BottomSheetLayout
    android:id="@+id/bottomsheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity"
    android:background="@color/colorFragmentBG"&gt;
    &lt;RelativeLayout
        android:id="@+id/main_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"&gt;
        &lt;android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:background="?attr/colorPrimary"
            android:elevation="6dp"
            android:minHeight="?attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/&gt;

        &lt;android.support.design.widget.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="@dimen/custom_tab_layout_height"
            android:layout_below="@+id/toolbar"
            android:background="?attr/colorPrimary"
            android:elevation="6dp"
            android:minHeight="?attr/actionBarSize"
            app:tabMode="scrollable"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/&gt;

        &lt;android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_below="@id/tab_layout"/&gt;
     &lt;/RelativeLayout&gt;
&lt;/com.flipboard.bottomsheet.BottomSheetLayout&gt;
</code></pre>

<p>Any help would be appreciated.</p>