ScrollView
안에 RecyclerView
를 사용하게 되면 이중 스크롤현상이 나타나서 제대로 스크롤기능을 사용하지 못하는 경우가 발생합니다.
이때 ScrollView
를 NestedScrollView
로 사용하게 되면 정상적으로 RecyclerView
의 스크롤을 동작할 수 있습니다.
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
---
예전에 작성된 Tistory 게시글을 velog로 이전 하였습니다.