Nestedscrollview | ((exclusive))
</LinearLayout> </androidx.core.widget.NestedScrollView> For the magic to work, the inner scrollable view (e.g., RecyclerView ) must have nested scrolling enabled. In modern AndroidX versions, this is true by default, but you can explicitly set it:
<androidx.coordinatorlayout.widget.CoordinatorLayout> <com.google.android.material.appbar.AppBarLayout> <com.google.android.material.appbar.CollapsingToolbarLayout app:layout_scrollFlags="scroll|exitUntilCollapsed"> <ImageView ... /> <androidx.appcompat.widget.Toolbar ... /> </com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.AppBarLayout> nestedscrollview
recyclerView.isNestedScrollingEnabled = true If you set it to false , RecyclerView will handle its own scrolling independently, breaking the coordinated behavior. Here lies the most frequent mistake developers make: Putting a RecyclerView inside a NestedScrollView and setting its height to wrap_content . </LinearLayout> </androidx