title: Android - material design: tabstrip with sliding tab (titles)
body: <p>In my App (Material Design) I would like to show (say) 10 tabs. Of those tabs, the tab strip should hold e.g. 4. Now the tabstrip shows all tab-titles with 2 letters per tab. 
  How can I create a sliding tabstrip? So I can scroll through the tab strip to the right tab? 
  I know there is a custom made tabstrip, I would like to use as much as possible standard facilities. </p>
  
  <p>1 - Setting up the tab pager: </p>
  
  <pre><code>private void setupTabPager() {
      viewPager = (ViewPager) findViewById(R.id.pager);
      final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
      viewPager.setAdapter(adapter);
      viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
      tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
          @Override
          public void onTabSelected(TabLayout.Tab tab) {
              // UserFeedback.show( "Tab selected: " + tab.getText());
              viewPager.setCurrentItem(tab.getPosition());
          }
          @Override
          public void onTabUnselected(TabLayout.Tab tab) {
          }
          @Override
          public void onTabReselected(TabLayout.Tab tab) {
          }
      });
  }
  </code></pre>
  
  <p>2 - Setting up the tab layout: </p>
  
  <pre><code>private void setupTablayout() {
      tabLayout = (TabLayout) findViewById(R.id.tabLayout);
      if (tabLayout == null) {
          return;
      }
      // tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
      tabLayout.setTabGravity(TabLayout.MODE_SCROLLABLE);
      tabLayout.addTab(tabLayout.newTab().setText("Folders"));
      tabLayout.addTab(tabLayout.newTab().setText("Items"));
  </code></pre>
  
  <p>3 - The PageAdapter extending FragmentStatePagerAdapter: </p>
  
  <pre><code>public class PagerAdapter extends FragmentStatePagerAdapter {
      int mNumOfTabs;
      public PagerAdapter(FragmentManager fm, int NumOfTabs) {
          super(fm);
          this.mNumOfTabs = NumOfTabs;
      }
      @Override
      public Fragment getItem(int position) {
          switch (position) {
              case MainActivity.FRAGMENT_GROUPS_AND_ITEMS:
                  return new FragmentGroupsAndItems();
              case MainActivity.FRAGMENT_FOLDERS:
                  return new FragmentFolders();
       .... }
  </code></pre>