解決ScrollView嵌套RecyclerView隻顯示一行的一種比較簡單的方法
ScrollView嵌套RecyclerView用多了,有些時候就會發現RecyclerView的資料隻顯示一行。
具體情況不是很清楚,隻是知道一種解決的辦法,話不多說
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
其實隻需要在 RecyclerView外層單獨加上RelativeLayout或者LinearLayout,RecyclerView就能正常顯示
隻是這個時候滑動沖突可能會導緻RecyclerView沒有滑動慣性了,就需要給RecyclerView設定屬性
關閉RecyclerView的嵌套滾動效果
完美滑動!