title: NestedScrollView containing content smaller than screen height Scrolls in CoordinatorLayout
body: <p>I'm trying to implement the ActionBar scrolling-with-content behavior introduced with Material Design.</p>
  
  <p>I'm trying to do it on a page which contains a <code>SlidingTabLayout</code> and a <code>ViewPager</code> as a direct sibling to the <code>AppBarLayout</code>. I have got to the current state by adding <code>app:layout_behavior="@string/appbar_scrolling_view_behavior"</code> to the <code>ViewPager</code>.</p>
  
  <p>This has resulted in two peices of unexpected behavior: </p>
  
  <p>1) When the <code>Fragment</code> content is smaller than the screen height, vertical scrolling still occurs (<code>AppBarLayout</code> contents shouldn't scroll if it's neighbor doesn't scroll).</p>
  
  <p>2) Scrolling <em>doesn't</em> happen when the scroll touch event starts on a touchable child element. <strong>Edit:</strong> this issue is described here <a href="https://code.google.com/p/android/issues/detail?id=182549" rel="noreferrer">Issue 182549</a></p>
  
  <p>You can see on this gif that the first ScrollEvent on Page0 displays issue 1 and the second scroll on Page0 shows issue 2. (Strangely, issue 2 isn't in evident on Page1).</p>
  
  <p><a href="https://i.stack.imgur.com/fAW2F.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/fAW2F.gif" alt="enter image description here"></a></p>
  
  <p>I have created an entire demo project which you can find on GitHub which exhibits this bug: <a href="https://github.com/gwoodhouse/TestApplication" rel="noreferrer">https://github.com/gwoodhouse/TestApplication</a></p>
  
  <p>For quick reference, my Activities xml is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout 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:background="@color/teal"
                                                   android:orientation="vertical"&gt;
  
  
      &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?android:attr/actionBarSize"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
              android:background="@color/teal"
              app:layout_scrollFlags="scroll|enterAlways"/&gt;
  
          &lt;com.example.graemecastle.testapplication.SlidingTabLayout
              android:id="@+id/slidingTabLayout"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="@color/background"
              app:layout_scrollFlags="scroll|enterAlways"/&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewPager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/background"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>My Fragments XML is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.NestedScrollView
      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;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="16dp"
          android:orientation="vertical"&gt;
  
          &lt;android.support.v7.widget.CardView
              android:layout_margin="16dp"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              app:cardBackgroundColor="@color/green"
              app:cardElevation="2dp"&gt;
  
              &lt;LinearLayout
  
                  android:layout_width="wrap_content"
                  android:layout_height="?android:attr/actionBarSize"
                  android:background="?android:attr/selectableItemBackground"
                  android:clickable="true"
                  android:gravity="center_vertical"
                  android:orientation="horizontal"&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="16dp"
                      android:text="Button"
                      android:textColor="#FFFFFF"/&gt;
  
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="8dp"
                      android:layout_marginRight="16dp"
                      android:text="&gt;"
                      android:textColor="#FFFFFF"/&gt;
              &lt;/LinearLayout&gt;
          &lt;/android.support.v7.widget.CardView&gt;
  
          &lt;!-- Extra Buttons Added Here to show how view's which should scroll scroll correctly --&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v4.widget.NestedScrollView&gt;
  </code></pre>
  
  <p>So far capturing the <code>onInterceptTouchEvent()</code> has not made it clear to me what is happening. Does anyone have any idea?</p>