Android - ScrollView 안에 RecyclerView 사용하기

JJo·2021년 6월 7일
0

Android

목록 보기
12/12

ScrollView 안에 RecyclerView 사용하기

ScrollView 안에 RecyclerView 를 사용하게 되면 이중 스크롤현상이 나타나서 제대로 스크롤기능을 사용하지 못하는 경우가 발생합니다.

이때 ScrollViewNestedScrollView로 사용하게 되면 정상적으로 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로 이전 하였습니다.
profile
안녕하세용!!!

0개의 댓글