Nestedscrollview Official

<androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">

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: nestedscrollview

In the modern Android ecosystem, user interfaces are rarely simple. They often consist of complex hybrids: a collapsing toolbar, a tab layout, a view pager, and within each tab, a RecyclerView or ListView . When you put scrolling containers inside other scrolling containers, you encounter the infamous scroll conflict . &lt;androidx

<TextView ... /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" android:nestedScrollingEnabled="true" /> <!-- Note this --> a tab layout

Gift this article