Android BottomSheet 리사이클러뷰 하단 잘림 현상 해결 (fix bottom cut off)

상상코딩·2023년 8월 14일
0

안드로이드

목록 보기
21/21

바텀시트 프래그먼트를 만들다 보면 하단에 리사이클러뷰를 쓸일이 많은데 이때 마지막 아이템 일부분이 잘리는 현상이 가끔 발생함.

해결방법

1. LinearLayout을 쓰면 해결된다.

2. ConstraintLayout을 쓰는 경우에는

  1. constraint 모두 연결하기(bottom 특히), height는 0dp 주지 않기.
  2. layout_constrainedHeight 속성에 true 주기
        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:overScrollMode="never"
            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
            app:layout_constrainedHeight="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tabContainer"
            app:layout_constraintVertical_bias="0"
            app:spanCount="2" />
profile
히히낙낙

1개의 댓글

comment-user-thumbnail
2023년 8월 14일

좋은 글 감사합니다. 자주 방문할게요 :)

답글 달기