方案1:
1)修改布局问题RelativeLayout 增加android:descendantFocusability="blocksDescendants
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
</ScrollView>
2)设置RecyclerView setHasFixedSize(true); setNestedScrollingEnabled(false);
mRv.setHasFixedSize(true);
mRv.setNestedScrollingEnabled(false);
方案2:
1)将ScrollView替换成android.support.v4.widget.NestedScrollView
2)设置RecyclerView setNestedScrollingEnabled(false)
方案3:
<androidx.core.widget.NestedScrollView
android:fillViewport="true"
android:layout_height="match_parent"
android:layout_width="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:overScrollMode="never"
android:scrollbars="none" />
</androidx.core.widget.NestedScrollView>
在NestedScrollView 增加 android:fillViewport=“true”
在RecyclerView 增加 android:overScrollMode=“never” android:scrollbars=“none”