title: PagerTabStrip tabs alignment to left
body: <p>I am using PagerTabStrip to set sliding tabs.  However, when I set three tabs, it shows the first tab in the center so users cannot see all three tabs at first glance.</p>
  
  <p>How can I align them to left?</p>
  
  <p><img src="https://i.stack.imgur.com/OSEjW.png" alt="enter image description here"></p>
  
  <p>I want to move tabs to the left like this.</p>
  
  <p><img src="https://i.stack.imgur.com/uaTFd.jpg" alt="enter image description here"></p>
  
  <p>I tried gravity, but no luck.</p>
  
  <pre><code>pagerTabStrip.setGravity(Gravity.LEFT);
  </code></pre>
  
  <p>This is the code for MainActivity.</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
      PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_tab_strip);
  
      FragmentPagerAdapter fragmentPagerAdapter = new MyFragmentPagerAdapter(
              getSupportFragmentManager());
      viewPager.setAdapter(fragmentPagerAdapter);
  
      pagerTabStrip.setGravity(Gravity.LEFT);
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>MyFragmentPagerAdapter extends FragmentPagerAdapter {
  
      private final String[] pageTitle = { "Entry", "History", "Report" };
  
      public MyFragmentPagerAdapter(FragmentManager fragmentManager) {
          super(fragmentManager);
      }
  
      @Override
      public Fragment getItem(int position) {
  
          Fragment fragment = new PageFragment();
          Bundle arguments = new Bundle();
          arguments.putString("pageIndex", Integer.toString(position + 1));
          fragment.setArguments(arguments);
          return fragment;
      }
  
      @Override
      public int getCount() {
          return pageTitle.length;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return pageTitle[position];
      }
  
  }
  </code></pre>
  
  <hr>
  
  <h2><strong>The Problem Solved!!</strong></h2>
  
  <p>You need to download the latest codes from github instead of google developer page.</p>
  
  <p><a href="https://github.com/google/iosched/blob/0a90bf8e6b90e9226f8c15b34eb7b1e4bf6d632e/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java" rel="noreferrer">SlidingTabLayout.java</a></p>
  
  <p><a href="https://github.com/google/iosched/blob/0a90bf8e6b90e9226f8c15b34eb7b1e4bf6d632e/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java" rel="noreferrer">SlidingTabStrip</a></p>
  
  <p>Then, you can use setDistributeEvenly(true) like this.</p>
  
  <pre><code>@Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
  
      // Get the ViewPager and set it's PagerAdapter so that it can display items
      mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
  
      FragmentManager fragmentManager = getFragmentManager();
      MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(fragmentManager);
      mViewPager.setAdapter(adapter);
  
      // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had
      // it's PagerAdapter set.
      mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
      mSlidingTabLayout.setDistributeEvenly(true);
      mSlidingTabLayout.setViewPager(mViewPager);
  }
  </code></pre>