By attaching the appbar_scrolling_view_behavior to the NestedScrollView , the scroll events automatically trigger the AppBarLayout to expand or collapse. If you are using Jetpack Compose, the equivalent is Modifier.nestedScroll . The same principles apply:
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 . nestedscrollview
<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> ImageView ... />