마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

BottomSheetBehavior, RecyclerView Scroll 관련 질문이 있습니다.

0 추천

안녕하세요

현재 Google Material에서 제공하는 BottomSheetBehavior을 이용하여 한 화면을 구현하는 중 RecyclerView Scroll에 문제가 생겨서 질문 드립니다.

제가 원하는 기능은, BottomSheetBehavior안에 recyclerview scroll이 BottomSheet Dragging과 따로 동작해야하는 사양입니다. 현재 동작은 BottomSheetBehavior의 State가 Expanded, 즉 완전히 펼쳐진 상태에서만 Recyclerview 스크롤이 동작합니다. 저는 해당 상태가 STATE_HALF_EXPANDED에서도 recyclerview 스크롤이 동작해야하는 상황인데 도통 서칭을 해도 잘 나오지 않아서 답답한 마음에 질문 드립니다.

 

현재 개발중인 xml은 밑과 비슷한 형식으로 구성되어있습니다.

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="view.activity.MyActivity">

    <!--my activity views-->
    <include layout="@layout/bottom_sheet_view" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

 

bottom_sheet_view.xml

<Constraint xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottom_sheet_searches"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical"
    app:behavior_hideable="false"
    app:behavior_peekHeight="56dp"
    app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

    <Constarint
        android:layout_width="match_parent"
        android:layout_height="56dp">

        <!--view-->

    </Constraint>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/my_list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
 />

</Constarint>

 

위와 같이 ConstraintLayout 안에 View에서는 BottomSheet Drag가 동작해도 상관없으며, RecyclerView를 클릭할때는 BottomSheet Drag 동작이 아닌 Recyclerview scroll 이 동작되는 기능이 필요합니다....

 

 

로논 (360 포인트) 님이 2022년 12월 12일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...