title: ViewPager swipe doesn't work with RecyclerView
body: <p>I want to implement a simple swipe navigation using a ViewPager with fragments that hold and manage a RecyclerView.</p>
  
  <p>The Fragments are created and can be switched using <code>setCurrentItem()</code>, but you cannot swipe left or right to switch pages. The ViewPager seems to ignore any swipe gesture.</p>
  
  <p>My Activity layout:</p>
  
  <pre><code>&lt;FrameLayout
      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"&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewPager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginTop="?attr/actionBarSize"/&gt;
  
      &lt;android.support.v7.widget.Toolbar
                    ...                 /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>I populate the ViewPager using a <code>FragmentPagerAdapter</code> in my <code>onCreate()</code> like so:</p>
  
  <pre><code>viewPager = (ViewPager) findViewById(R.id.viewPager);
  viewPager.addOnPageChangeListener(this);
  viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
         @Override
         public Fragment getItem(int position) {
             switch (position) {
                 case 0:
                     return new Dummy2Fragment();
  
                 case 1:
                     return new Dummy2Fragment();
  
                 default:
                     return null;
             }
          }
  
         @Override
         public int getCount() {
             return 2;
         }
  
         @Override
         public CharSequence getPageTitle(int position) {
             return "Dataset " + (position + 1);
         }
     });
  </code></pre>
  
  <p>The fragment layout is a simple <code>FrameLayout</code> which wraps a RecyclerView:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/background_material_light"/&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>The adapter and the layout manager are set in the fragment's <code>onCreateView</code>:</p>
  
  <pre><code>recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
  recyclerView.setHasFixedSize(true);
  recyclerView.setAdapter(adapter);
  recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 6, LinearLayoutManager.VERTICAL, false));
  </code></pre>
  
  <hr>
  
  <p><strong>Edit #1</strong>  </p>
  
  <p>I think I did not ask my question clear enough.<br>
  I have a working Pager with a working TabLayout that is populated by a 'FragmentPagerAdapter', meaning that Fragments are properly created and the tab layout displays a clickable tab for each item. Every Fragment in this ViewPager displays a <code>RecyclerView</code> with a <code>GridLayoutManager</code>.</p>
  
  <p>However, the ViewPager doesn't seem to receive any swipe gesture, You can change the current selected position via the <code>TabLayout</code>, but not by swiping for example from left to right.<br>
  It looks like the <code>RecyclerView</code> consumes all swipe events regardless of the layout direction, which is set to <code>vertical</code>.</p>
  
  <p>Any ideas?</p>