Nestedscrollview ~repack~ May 2026
| Do | Don't | |----|-------| | Use NestedScrollView with CoordinatorLayout for collapsing toolbars. | Put a RecyclerView with wrap_content inside it for long lists. | | Enable fillViewport to fill the screen when content is short. | Nest NestedScrollView inside another NestedScrollView . | | Keep inner lists small (< 10 items) or use multiple view types in a single RecyclerView . | Assume NestedScrollView is a drop-in performance upgrade – it has overhead. | | Test scroll fling behavior – physics can feel different. | Forget to handle keyboard visibility if the view contains EditText fields. | Final Take NestedScrollView is not a magic bullet, but it is an indispensable tool for modern, material-design-compliant Android apps. Use it when you need coordination , avoid it when you simply need containment . Respect the recycling system, and your scrolling will be buttery smooth.
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 . nestedscrollview
<androidx.core.widget.NestedScrollView app:layout_behavior="@string/appbar_scrolling_view_behavior"> <!-- Content here --> </androidx.core.widget.NestedScrollView> </androidx.coordinatorlayout.widget.CoordinatorLayout> | Do | Don't | |----|-------| | Use
<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> | Nest NestedScrollView inside another NestedScrollView
<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">