ConsecutiveScroller icon indicating copy to clipboard operation
ConsecutiveScroller copied to clipboard

与SmartRefreshLayout嵌套导致的越界滑动效果不连贯的问题

Open Matcha-xiaobin opened this issue 1 year ago • 1 comments

最外层是SmartRefreshLayout,用来实现越界滑动效果 然后SmartRefreshLayout的直接子View是CoordinatorLayout,用来实现折叠头部 CoordinatorLayout的第二子View就是ConsecutiveScrollerLayout了 然后想要实现的效果是: ConsecutiveScrollerLayout滑动到顶部了,头部也展开完毕,手指不抬起,继续往下移动,要能丝滑的触发SmartRefreshLayout的越界滑动效果。

问题1:目前到顶后不松开手指丝是做不到的,一定要抬起手指,再次下拉才能有效果 问题2:滑动到顶后,头部也展开了,抬起手指,在此下拉,想要触发SmartRefreshLayout的越界效果,但是手指在触摸到ConsecutiveScrollerLayout中的某些子view的时候,并不能正确触发,不明白什么原因导致的。 目前我检查了下我布局,有没有可能,有些控件是一开始就Gone了,某种条件下才显示出来,然后导致滑动不了? 控件的visibility属性是这么控制的(dataBinding): android:visibility="@{historyData==null?View.GONE:View.VISIBLE}" 似乎TextView是直接子View的时候,触摸这个TextView下拉是拉不动的。

大佬对这个问题可有什么思路嘛?

原布局代码太多,贴下简化后的代码 `` <com.scwang.smart.refresh.layout.SmartRefreshLayout android:layout_width="match_parent" android:layout_height="match_parent" app:srlEnablePureScrollMode="true">

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"/>

    <com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_isSticky="true"/>

        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="4dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_isSticky="true" />

        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

</com.scwang.smart.refresh.layout.SmartRefreshLayout> ‘’

Matcha-xiaobin avatar Aug 30 '22 07:08 Matcha-xiaobin

补充一下,惯性滑动到顶后能触发越界回弹效果,仅仅只是手指不抬起的情况下不行。

Matcha-xiaobin avatar Aug 30 '22 07:08 Matcha-xiaobin