问题描述

在ScrollView嵌套ListVIew、GirdView的时候都会出现显示不全的情况,对于这种情况只需要重写ListView和GridView的高度即可。
  在Android6.0以下,ScrollView嵌套RecyclerView并不会出现显示不全的问题,但是在Android6.0及以上版本使用这种布局嵌套的时候就会出现RecyclerView显示不全的问题,解决方法很简单,只需要在RecyclerView的外面套上一层RelativeLayout即可,代码如下:

1
2
3
4
5
6
7
8
9
10
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">

<android.support.v7.widget.RecyclerView
android:id="@+id/gv_goods_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>

转载自进击的阿达