RecyclerView Scrol在列表末尾时自行触摸

我有一个奇怪的问题。在列表的末尾,recyclerView会自动向上滚动。

当我将recyclerView设置为滑动布局的直接子代时,它会起作用。

或者,如果我将滑动布局替换为其他布局,则效果很好。

我该如何解决?

我的XML布局代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    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">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"

            android:layout_height="match_parent">

            <TextView
                android:id="@+id/tasksCountTv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:src="@drawable/ic_sort_icon"
                app:layout_constraintBottom_toTopOf="@id/listRc"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />


            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/listRc"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:orientation="vertical"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tasksCountTv" />


            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/sortingDialogCl"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:visibility="invisible"
                app:layout_constraintBottom_toBottomOf="parent">

                <TextView
                    android:id="@+id/sortByLabelTv"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="20dp"
                    android:layout_marginTop="10dp"
                    android:text="@string/sort_by"
                    android:textColor="@color/contact_view_color"
                    android:textSize="16sp"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

我使用这些库:

swiperefreshlayout:1.1.0-alpha03
recyclerview:1.1.0-rc01
constraintlayout:2.0.0-beta3

RecyclerView Scrol在列表末尾时自行触摸

zhouhsmp3 回答:RecyclerView Scrol在列表末尾时自行触摸

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3144660.html

大家都在问