带有 nestedscrollview 的嵌套 RecyclerView 不滚动
Nested RecyclerView with nestedscrollview is not scrolling
我有一行在另一个 recyclerview 中有一个 recyclerview,就像这张图片
我需要内部 recyclerview 才能滚动它,我试过了(这是在 ConstrainLayout 内)
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="150dp"
android:fillViewport="true"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_items"
android:layout_width="match_parent"
android:layout_height="0dp" />
</androidx.core.widget.NestedScrollView>
和
rv_order_items.isNestedScrollingEnabled = true
但是我无法在内部 recyclerview 中滚动,有什么建议吗?
请在此 post 中添加您的布局的完整代码,以便我了解约束布局。
否则,如果您想全屏滚动,这就是解决方案...
请设置 NestedScrollViewandroid:layout_height="match_parent"
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
我有一行在另一个 recyclerview 中有一个 recyclerview,就像这张图片
我需要内部 recyclerview 才能滚动它,我试过了(这是在 ConstrainLayout 内)
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="150dp"
android:fillViewport="true"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_items"
android:layout_width="match_parent"
android:layout_height="0dp" />
</androidx.core.widget.NestedScrollView>
和
rv_order_items.isNestedScrollingEnabled = true
但是我无法在内部 recyclerview 中滚动,有什么建议吗?
请在此 post 中添加您的布局的完整代码,以便我了解约束布局。
否则,如果您想全屏滚动,这就是解决方案...
请设置 NestedScrollView
android:layout_height="match_parent"
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">