布局這樣寫, 用RelativeLayout包裹住RecyclerView, 添加android:descendantFocusability="blocksDescendants"屬性
<RelativeLayout
android:id="@+id/rl_recycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:descendantFocusability="blocksDescendants">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_gravity="center_horizontal"
android:overScrollFooter="@android:color/transparent"
android:overScrollHeader="@android:color/transparent"
android:overScrollMode="never"
android:scrollbars="vertical"
android:clipToPadding="false"/>
</RelativeLayout>
java代碼中,加上這句話
recycle_view.setNestedScrollingEnabled(false);//禁止rcyc嵌套滑動
這樣,就會很流暢,達到不卡,不沖突效果
有幫助,請給個關注,Thanks~
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/249507.html
標籤:其他
上一篇:10.運算子之挖坑埋坑
下一篇:C++(OOP)例外
