title: Second fragment in ViewPager consumes scroll events
body: <p>I have a <code>SwipeRefreshLayout</code> that hosts <code>ViewPager</code> in my Activity. 
  I am adding two fragments to the ViewPager. The first fragment has <code>RecyclerView</code> and the second fragment has a <code>ScrollView</code>.</p>
  
  <p>On the first fragment, <code>SwipeRefreshLayout</code> was consuming scroll event. I added <code>OnScrollListener</code> and I am disabling refreshing if the view is not on the top.</p>
  
  <p>I have same the problem with <code>ScrollView</code> in the second fragment, and I added <code>ViewTreeObserver.OnScrollChangedListener()</code> to <code>ScrollView</code>.</p>
  
  <p>However, when I am on the first page, the scroll event passes to second page. </p>
  
  <p>I tried to set <code>android:clickable="true"</code> on parent view of the first fragment and it didn't work.</p>
  
  <p>Any recommendation would be helpful.</p>
  
  <p><strong>my_activity.xml</strong>
      
  </p>
  
  <pre><code>&lt;include android:id="@+id/toolbar" layout="@layout/include_toolbar" /&gt;
  
  &lt;FrameLayout
      android:id="@id/container"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@id/toolbar"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tab_layout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="?attr/colorPrimary"
              android:minHeight="?attr/actionBarSize"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/&gt;
  
          &lt;android.support.v4.widget.SwipeRefreshLayout
              android:id="@+id/swipe_container"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@drawable/login_background"
              android:fillViewport="true"
              android:fitsSystemWindows="true"
              android:layout_below="@id/tab_layout"&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;TextView
                      android:id="@+id/last_update"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:paddingLeft="@dimen/normal_padding"
                      android:paddingTop="@dimen/small_padding"
                      android:textColor="@color/gray"
                      android:paddingBottom="@dimen/small_padding"
                      android:textSize="@dimen/caption"
                      android:textStyle="bold" /&gt;
  
                  &lt;android.support.v4.view.ViewPager
                      android:id="@+id/pager"
                      android:layout_below="@id/last_update"
                      android:layout_width="match_parent"
                      android:layout_height="fill_parent"/&gt;
  
              &lt;/RelativeLayout&gt;
  
          &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>first_fragment.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:elevation="16dp"
  android:background="@android:color/transparent"
  android:clickable="true"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/recycler_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:scrollbars="vertical" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>second_fragment.xml</strong></p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/container"
  android:background="@android:color/transparent"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:clickable="true"&gt;
  
  There are some child views here. 
  
  &lt;/ScrollView
  </code></pre>
  
  <p><strong>SecondFragment</strong></p>
  
  <pre><code>    onScrollChangedListener = new ViewTreeObserver.OnScrollChangedListener() {
          @Override
          public void onScrollChanged() {
              SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
  
              int scrollY = scrollView.getScrollY();
              if (scrollY == 0) swipeRefreshLayout.setEnabled(true);
              else swipeRefreshLayout.setEnabled(false);
  
          }
      };
  
      scrollView.getViewTreeObserver().addOnScrollChangedListener(onScrollChangedListener);
  </code></pre>