RecyclerView嵌套一层RelativeLayout即可解决


  <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
  		<ScrollView
            	android:layout_width="0dp"
            	android:layout_height="0dp"
            	android:fillViewport="true"
            	android:scrollbars="none"
            	app:layout_constrainedWidth="true"
            	app:layout_constraintBottom_toBottomOf="parent"
            	app:layout_constraintEnd_toEndOf="parent"
           	    app:layout_constraintStart_toStartOf="parent"
           		app:layout_constraintTop_toBottomOf="@id/head">
           		 <!-- 1.将RecyclerView 用 RelativeLayout 包裹 -->
                <RelativeLayout
                    android:id="@+id/comment_detail"
                    app:layout_constraintTop_toBottomOf="@+id/sort"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    >

                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/xxxx"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:nestedScrollingEnabled="false" />
                    <!-- 2.android:nestedScrollingEnabled="false" 禁止滑动 -->
                </RelativeLayout>


			

 		</ScrollView>
 </androidx.constraintlayout.widget.ConstraintLayout>
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐