【发布时间】:2018-02-22 15:36:46
【问题描述】:
我正在尝试实现嵌套的RecyclerView。我这样做了,但父 RecyclerView 滚动时滚动不流畅。我做了很多优化,但仍然没有成功滚动,直到我将父 recyclerview 放入NestedScrollView。 Scroll 现在完美无缺,但我有一个问题。
如果我滚动(哪怕是一点点)我的内部 RecyclerView(水平),我会立即回到 [垂直 recyclerview - 父级] 的开头。
这种情况会发生一次。为什么会这样,是否有可能修复它?
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/parent_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
-
RecyclerView.setNestedScrollingEnabled(false); -
@NileshRathod 我在父 recyclerview 上有
setNestedScrollingEnabled(false)。 -
If I scroll till the end of my inner RecyclerView (horizontal), I immediately get back to the start.- 您的水平起点RecyclerView或父RecyclerView? -
水平的
RecyclerView在滚动结束时是否加载新数据?
标签: android android-recyclerview