title: Android NestedScrollView doesn't work in layout with viewpager
body: <p>This is my layout:
  <a href="https://i.stack.imgur.com/ScVbR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ScVbR.png" alt="enter image description here"></a></p>
  
  <p>I want to be able to scroll upper parth of the layout (with name, image, textviews for followers/following...) when I scroll recyclerView in viewPager, so I read that I can use NestedScrollView to implement that, so I put NestedScrollView as my root layout:</p>
  
  <pre><code>NestedScrollView:
  -----------------ConstraintLayout:
  ---------------------------------rest of the views as in picture above
  </code></pre>
  
  <p>I also added android:fillViewport="true" in NEstedScrollView because that solves a broblem of missing view pager.
  So the problem is that scroll view doesn't work, everything is same as before uting nestedScrollView , bottom part of my layout doesn't scroll of the screen while I scroll recyclerView. Doesn anyone know why, am I using nested scrollView wrong, I haven't found any example that can solve my problem and documentation is really bad.
  XML code for my layout:</p>
  
  <pre><code>&lt;androidx.core.widget.NestedScrollView
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:fillViewport="true"&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:background="?attr/colorPrimary"
                  android:theme="?attr/actionBarTheme"
                  android:minHeight="?attr/actionBarSize"
                  android:elevation="4dp"
                  android:id="@+id/title"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  tools:title="UserName"
                  app:layout_constraintEnd_toEndOf="parent"/&gt;
  
          &lt;de.hdodenhof.circleimageview.CircleImageView
                  android:id="@+id/profile_image"
                  android:layout_width="80dp"
                  android:layout_height="80dp"
                  android:layout_margin="8dp"
                  app:srcCompat="@drawable/ic_profile_24dp"
                  tools:src="@drawable/ic_profile_24dp"
                  app:civ_border_color="@color/primaryLightColor"
                  app:civ_border_width="1dp" android:layout_marginTop="8dp"
                  app:layout_constraintTop_toBottomOf="@+id/title" android:layout_marginStart="8dp"
                  app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"/&gt;
          &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="0dp"
                  android:id="@+id/textView"
                  app:layout_constraintEnd_toEndOf="parent"
                  android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
                  app:layout_constraintStart_toEndOf="@+id/profile_image" android:layout_marginLeft="8dp"
                  android:layout_marginStart="8dp"
                  app:layout_constraintBottom_toBottomOf="@+id/profile_image"
                  app:layout_constraintTop_toTopOf="@+id/profile_image"
                  tools:text="Short description "/&gt;
  
          &lt;TextView
                  android:id="@+id/questions_label"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:text="@string/questions"
                  android:layout_marginTop="8dp"
                  app:layout_constraintTop_toBottomOf="@+id/profile_image" app:layout_constraintStart_toStartOf="parent"
                  android:layout_marginLeft="8dp" android:layout_marginStart="8dp"
                  app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toStartOf="@+id/followers_label"/&gt;
          &lt;TextView
                  android:id="@+id/questions_number"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:textSize="18sp"
                  android:textStyle="bold"
                  tools:text="0"
                  app:layout_constraintTop_toBottomOf="@+id/questions_label"
                  app:layout_constraintEnd_toEndOf="@+id/questions_label"
                  app:layout_constraintStart_toStartOf="@+id/questions_label"/&gt;
  
          &lt;TextView
                  android:id="@+id/followers_label"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:text="@string/followers"
                  android:layout_marginTop="8dp"
                  app:layout_constraintTop_toBottomOf="@+id/profile_image"
                  app:layout_constraintStart_toEndOf="@+id/questions_label" android:layout_marginStart="8dp"
                  android:layout_marginLeft="8dp" android:layout_marginEnd="8dp"
                  app:layout_constraintEnd_toStartOf="@+id/following_label" android:layout_marginRight="8dp"
                  app:layout_constraintHorizontal_bias="0.5"/&gt;
  
          &lt;TextView
                  android:id="@+id/following_label"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:text="@string/following"
                  android:layout_marginTop="8dp"
                  app:layout_constraintTop_toBottomOf="@+id/profile_image" android:layout_marginEnd="8dp"
                  app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"
                  app:layout_constraintStart_toEndOf="@+id/followers_label" app:layout_constraintHorizontal_bias="0.5"/&gt;
          &lt;TextView
                  android:id="@+id/followers_number"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:textSize="18sp"
                  android:textStyle="bold"
                  tools:text="0"
                  app:layout_constraintEnd_toEndOf="@+id/followers_label"
                  app:layout_constraintStart_toStartOf="@+id/followers_label"
                  app:layout_constraintTop_toBottomOf="@+id/followers_label"/&gt;
          &lt;TextView
                  android:id="@+id/following_number"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:textSize="18sp"
                  android:textStyle="bold"
                  tools:text="0"
                  app:layout_constraintEnd_toEndOf="@+id/following_label"
                  app:layout_constraintStart_toStartOf="@+id/following_label"
                  app:layout_constraintTop_toBottomOf="@+id/following_label"/&gt;
  
          &lt;com.google.android.material.tabs.TabLayout
                  android:id="@+id/sliding_tabs"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:background="@color/primaryLightColor"
                  app:tabMode="fixed" app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  android:layout_marginTop="8dp"
                  app:layout_constraintTop_toBottomOf="@+id/followers_number"/&gt;
  
          &lt;androidx.viewpager.widget.ViewPager
                  android:id="@+id/view_pager"
                  android:layout_width="0dp"
                  android:layout_height="0dp"
                  android:background="@android:color/white"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toBottomOf="@+id/sliding_tabs" /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/androidx.core.widget.NestedScrollView&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong> code after suggestion:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
      &lt;com.google.android.material.appbar.AppBarLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="?attr/colorPrimary"
                  android:theme="?attr/actionBarTheme"
                  android:minHeight="?attr/actionBarSize"
                  android:id="@+id/title"
                  tools:title="UserName"/&gt;
      &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  
      &lt;androidx.core.widget.NestedScrollView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:fillViewport="true"
              app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
          &lt;androidx.constraintlayout.widget.ConstraintLayout
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"&gt;
  
              &lt;de.hdodenhof.circleimageview.CircleImageView
                      android:id="@+id/profile_image"
                      android:layout_width="80dp"
                      android:layout_height="80dp"
                      android:layout_marginStart="@dimen/spacing_normal"
                      android:layout_marginLeft="@dimen/spacing_normal"
                      android:layout_marginTop="@dimen/spacing_normal"
                      app:civ_border_color="@color/secondaryDarkColor"
                      app:civ_border_width="1dp"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toTopOf="parent"
                      app:srcCompat="@drawable/ic_profile_24dp"
                      tools:src="@drawable/ic_profile_24dp" /&gt;
  
              &lt;com.google.android.material.textview.MaterialTextView
                      android:layout_width="0dp"
                      android:layout_height="0dp"
                      android:id="@+id/description"
                      android:layout_marginEnd="@dimen/spacing_normal"
                      android:layout_marginRight="@dimen/spacing_normal"
                      android:layout_marginLeft="@dimen/spacing_normal"
                      android:layout_marginStart="@dimen/spacing_normal"
                      app:layout_constraintStart_toEndOf="@+id/profile_image"
                      app:layout_constraintEnd_toEndOf="parent"                    app:layout_constraintBottom_toBottomOf="@+id/profile_image"
                      app:layout_constraintTop_toTopOf="@+id/profile_image"
                      tools:text="Short description "/&gt;
  
              &lt;include
                      layout="@layout/qff_layout"
                      android:id="@+id/qff_layout"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/spacing_small"
                      app:layout_constraintTop_toBottomOf="@+id/profile_image"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"/&gt;
  
              &lt;com.google.android.material.tabs.TabLayout
                      android:id="@+id/sliding_tabs"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:background="@color/primaryLightColor"
                      app:tabMode="fixed"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/qff_layout"/&gt;
  
              &lt;androidx.viewpager.widget.ViewPager
                      android:id="@+id/view_pager"
                      android:layout_width="0dp"
                      android:layout_height="0dp"
                      android:background="@android:color/white"
                      app:layout_constraintBottom_toBottomOf="parent"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/sliding_tabs" /&gt;
  
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
      &lt;/androidx.core.widget.NestedScrollView&gt;
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>What is wrong here, It doesn't make any sense, nothing scrolls except ViewPager</p>