XPopup icon indicating copy to clipboard operation
XPopup copied to clipboard

DrawerPopupView与ListView中的可滑动控件冲突

Open gamedragon opened this issue 4 years ago • 1 comments

在DrawerPopupView中放置一个RecyclerView,如下所示:

    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="vertical">
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"/>
    <com.jiagu.ags3.MySeekBar
        android:id="@+id/seek"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginEnd="20dp"
        android:layout_marginStart="20dp" />
</LinearLayout>```
如果此RecyclerView中存在诸如SeekBar之类的可横向滑动控件时,会与PopupDrawerLayout中的滑动事件相冲突。比如DrawerPopupView从左侧滑出,SeekBar的滑块在最右边,无法将滑块向左滑动时,向左滑动只会导致DrawerPopupView回收。

但是如果SeekBar不在RecyclerView中,如上面的seek控件,直接在PopupDrawerLayout容器中,这时候是可以正确处理。

比较粗暴的解决方法是在`PopupDrawerLayout::canScroll`方法中判断子控件如果是SeekBar类型则返回true,这样可以暂时解决这个问题。

gamedragon avatar Dec 07 '21 12:12 gamedragon

@gamedragon enableDrag(false)

junixapp avatar Jul 24 '22 14:07 junixapp