title: Why did my Material Swipe Tabs keep collapsing?
body: <p>I have a problem with Swipe Tabs. The Tabs have collapased.</p>
  
  <pre><code>public class Swipe extends AppCompatActivity {
  
  
      private Toolbar toolbar;
      private TabLayout tabLayout;
      private ViewPager viewPager;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_swipe);
  
          toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setHomeButtonEnabled(true);
          getSupportActionBar().show();
  
  
  
          viewPager = (ViewPager) findViewById(R.id.viewpager);
          setupViewPager(viewPager);
  
          tabLayout = (TabLayout) findViewById(R.id.tabs);
          tabLayout.setupWithViewPager(viewPager);
      }
  
      private void setupViewPager(ViewPager viewPager)
      {
  
          ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
          adapter.addFrag(new OneFragment(), "ONE");
          adapter.addFrag(new TwoFragment(), "TWO");
          adapter.addFrag(new ThreeFragment(), "THREE");
          adapter.addFrag(new FourFragment(), "FOUR");
          adapter.addFrag(new FiveFragment(), "FIVE");
          adapter.addFrag(new SixFragment(), "SIX");
          adapter.addFrag(new SevenFragment(), "SEVEN");
          adapter.addFrag(new EightFragment(), "EIGHT");
          adapter.addFrag(new NineFragment(), "NINE");
          adapter.addFrag(new TenFragment(), "TEN");
          viewPager.setAdapter(adapter);
  
  
      }
  
  
      class ViewPagerAdapter extends FragmentPagerAdapter {
          private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
          private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
          public ViewPagerAdapter(FragmentManager manager) {
              super(manager);
          }
  
          @Override
          public Fragment getItem(int position) {
              return mFragmentList.get(position);
          }
  
          @Override
          public int getCount() {
              return mFragmentList.size();
          }
  
          public void addFrag(Fragment fragment, String title) {
              mFragmentList.add(fragment);
              mFragmentTitleList.add(title);
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              return mFragmentTitleList.get(position);
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          return super.onCreateOptionsMenu(menu);
      }
  
  
          @Override
          public boolean onOptionsItemSelected(MenuItem item) {
              // Handle action bar item clicks here. The action bar will
              // automatically handle clicks on the Home/Up button, so long
              // as you specify a parent activity in AndroidManifest.xml.
              int id = item.getItemId();
  
              //noinspection SimplifiableIfStatement
              if (id == R.id.home)
              {
  
              /*mSearchView.show(true);*/ // animate, ONLY FOR MENU ITEM
              /*onSearchRequested();*/
                  NavUtils.navigateUpFromSameTask(this);
                  finish();
  
              }
  
              return super.onOptionsItemSelected(item);
          }
      }
  </code></pre>
  
  <p>activity_swipe.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/lib/ezomart.com.ezomart"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="ezomart.com.ezomart.Swipe"&gt;
  
      &lt;include
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          layout="@layout/toolbar"
          /&gt;
  
      &lt;!--&lt;android.support.design.widget.TabLayout
          android:id="@+id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:tabMode="fixed"
          android:background="@color/colorPrimary"
          android:layout_below ="@id/toolbar"
         /&gt;--&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:tabMode="scrollable"
          android:background="@color/colorPrimary"
          android:layout_below ="@id/toolbar"/&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"  /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Please see the link below for reference. I have attached the code above.</p>
  
  <p><a href="http://s15.postimg.org/hf24q14kb/material.png" rel="nofollow">http://s15.postimg.org/hf24q14kb/material.png</a></p>