title: TabLayout get stuck with viewpager when screen orientation change
body: <p>I am using the design support library. I've a Fragment and inside this fragment I have another fragment which has view pager with 3 new fragment</p>
  
  <p>My fragment code -</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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:orientation="vertical"&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tab_layout"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="@color/colorPrimary"
          app:tabIndicatorColor="@android:color/white"
          app:tabIndicatorHeight="4dp"
          app:tabMode="fixed" /&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/pager"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Fragment Java code</p>
  
  <pre><code>    @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.fragment_main, container, false);
  
          TabLayout tabLayout = (TabLayout) v.findViewById(R.id.tab_layout);
          tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
          tabLayout.setTabTextColors(Color.parseColor("#ffffff"), Color.parseColor("#000000"));
          ViewPager viewPager = (ViewPager) v.findViewById(R.id.pager);
          viewPager.setOffscreenPageLimit(3);
          viewPager.setAdapter(new SectionPagerAdapter(getActivity().getSupportFragmentManager()));
          tabLayout.setupWithViewPager(viewPager);
          return v;
      }
  
      public class SectionPagerAdapter extends FragmentPagerAdapter {
  
          public SectionPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
              switch (position) {
                  case 0:
                      return new Tab1();
                  case 1:
                      return new Tab2();
                  case 2:
                      return new Tab3();
  
                  default:
                      return null;
              }
          }
  
          @Override
          public int getCount() {
              return 3;
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              switch (position) {
                  case 0:
                      return "Tab 1";
                  case 1:
                      return "Tab 2";
                  case 2:
                      return "Tab 3";
  
                  default:
                      return "";
              }
          }
      }
  </code></pre>
  
  <p>Now its all working fine but when I rotate the screen, swipe on viewpager does not work correctly. I mean it get stuck in between two tabs. Also the tab indicator also get stuck between tabs. It takes almost 6-7 swipe to go from 1st to 3rd tab. Also when swiping after rotating there is only one tab fragment which was previously choose before rotating.</p>