- 关于ScrollView嵌套RecyclerView时Recyc
- ScrollView嵌套RecyclerView A,Recyc
- ScrollView 嵌套 RecyclerView,Recyc
- 简单实现RecyclerView嵌套RecyclerView
- RecyclerView常见问题解决方案
- 2019-05-04 ScrollView嵌套Recyclerv
- ScrollView 嵌套RecyclerView 在Andro
- 解决ScrollView嵌套RecyclerView出现item
- 关于ScrollView的若干问题,比如嵌套view然后失去惯性
- scrollView嵌套recyclerView 显示不全
在新版本中需求变更导致布局需要变化,RecyclerView外需要一层ScrollView来处理滑动。发布前夕发现在API 23 & 24上RecyclerView显示不完整。
光速冷静下来,马上去stackoverflow翻了一下,有人说ScrollView加上 android:fillViewport="true"
,但是我加上并没有解决问题。后来在RecyclerView外面加了一层RelativeLayout,问题解决。如果你在API 23 & 24上也遇到这个问题,可以参考一下。
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- DEV NOTE: Outer wrapper relative layout is added intentionally to address issue
that only happens on Marshmallow & Nougat devices (API 23 & 24).
On marshmallow API 23, the "RecyclerView" `layout_height="wrap_content"` does NOT
occupy the height of all the elements added to it via adapter. The result is cut out
items that is outside of device viewport when it loads initially.
Wrapping "RecyclerView" with "RelativeLayout" fixes the issue on Marshmallow devices.
-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/rv_fragment_find_tips_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
网友评论