BottomSheetBehavior가있는 LinearLayout 안에 두 개의 RecyclerView가 있습니다. 첫 번째 RecyclerView 안의 항목 (격자가있는)을 클릭하면 RecyclerView가 Gone으로 설정되고 두 번째 RecyclerView (목록 있음)가 표시됩니다. 두 번째 Recycler가 표시되면 BottomSheet를 위아래로 밀어 넣을 수 없습니다. 대신 목록이 펼쳐진 상태에서도 스크롤됩니다. First Recycler가 작동되면 모든 것이 정상입니다. BottomSheet를 위아래로 슬라이드 할 수있는 방법이 있습니까?두 개의 RecyclerView가있는 BottomSheetBehavior
<LinearLayout
android:id="@+id/sliding_layout_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="400dp"
app:layout_behavior="@string/bottomSheetBehavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:background="@color/white"
android:clickable="true"
android:scrollbars="none" />
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:background="@color/white"
android:clickable="true"
android:scrollbars="none" />
</LinearLayout>
GridAdapter :
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
String categorieName = mCategories.get(position);
final CategoryFilterEvent event = new CategoryFilterEvent(categorieName);
holder.grid_item_label.setText(categorieName);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EventBus.getDefault().post(event);
}
});
}
MainActivity :
@Override
public void onCreate(Bundle savedInstanceState) {
linearLayoutManager = new LinearLayoutManager(this);
listAdapter = new ListAdapter(this, mList);
recyList.setAdapter(listAdapter);
recyList.setLayoutManager(linearLayoutManager);
gridLayoutManager = new GridLayoutManager(this, 3);
gridAdapter = new GridAdapter(this, new ArrayList<String>());
recyGrid.setAdapter(gridAdapter);
recyGrid.setLayoutManager(gridLayoutManager);
}
public void onEventMainThread(CategoryFilterEvent event) {
recyGrid.setVisibilty(GONE);
recyList.setVisiblity(VISIBLE);
}
손가락으로 슬라이드하면 하단 시트가 위아래로 이동한다는 문제가 있다고 생각하지만 리사이틀보기가 하단 시트 안쪽으로 들어가면 손가락으로 문질러 대는 동작이 리사이클 뷰에서 사용됩니다. 나는 당신이 밑바닥 시트의 내부에 리시버 뷰를 넣는 것이 문제라고 생각한다. –
하지만 첫 번째 RecyclerView에서는 완벽하게 작동합니다. – elpatricko
일부 코드를 공유 –