BaseBottomSheetFragment嵌套RecyclerView滑动冲突

2022-07-31 10:15:31

BaseBottomSheetFragment里面的如下代码会存在滑动冲突

<com.scwang.smart.refresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/srl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <com.tencent.cloud.iov.paging.state.StateLayout
        android:id="@+id/state_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="6dp"
            android:overScrollMode="never" />
    </com.tencent.cloud.iov.paging.state.StateLayout>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>

解决方法:

让最外层不能嵌套滑动,里面的recyclerView可以嵌套滑动,并且禁止下拉刷新即可

mRvContent.setNestedScrollingEnabled(true);
mRefreshLayout.setNestedScrollingEnabled(false);
mRefreshLayout.setEnableRefresh(false);
  • 作者:小蜗牛在漫步
  • 原文链接:https://blog.csdn.net/chenli_001/article/details/125484140
    更新时间:2022-07-31 10:15:31