NestedScrollView 内的 ConstraintLayout (带有 RecyclerView )

Posted

技术标签:

【中文标题】NestedScrollView 内的 ConstraintLayout (带有 RecyclerView )【英文标题】:ConstraintLayout (with RecyclerView ) inside NestedScrollView 【发布时间】:2019-04-26 02:56:42 【问题描述】:

当我尝试滚动 RecyclerView 的外部区域时,我有这样的结构它不起作用(滚动)

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_
android:layout_  
android:fillViewport="true">

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/root"
    android:layout_
    android:layout_
    >

    <androidx.cardview.widget.CardView     
    </androidx.cardview.widget.CardView>

    <androidx.recyclerview.widget.RecyclerView
     />

</androidx.constraintlayout.widget.ConstraintLayout>

对此有任何帮助!!!

【问题讨论】:

希望这对你有帮助 medium.com/widgetlabs-engineering/… 和 ***.com/questions/31000081/… 会尝试告诉你 【参考方案1】:

您可以尝试为RecyclerView - android:nestedScrollingEnabled="false" 添加此属性

【讨论】:

【参考方案2】:

NestedScrollView 换行 约束布局包装

RecyclerView 包装

【讨论】:

以上是关于NestedScrollView 内的 ConstraintLayout (带有 RecyclerView )的主要内容,如果未能解决你的问题,请参考以下文章

无法滚动到 NestedScrollView 内的 RecyclerView 中的项目

NestedScrollView 内的回收器视图导致滚动从中间开始

NestedScrollView 内的 RecyclerView :使水平滚动更容易

ConstraintLayout 内的 NestedScrollView 不可滚动

NestedScrollView 内的子级未覆盖整个屏幕高度

NestedScrollview 内的 RecyclerView 滚动不顺畅