在最近项目中遇到 ,在RecyclerView加载list数据时,高度没法自适应增加,看了不少博客,各类尝试,都没有解决这个问题,在某个博客中,讲到此解决方法,在此记录下。android
即在RecyclerView 布局时用 RelativeLayout 包裹着,即:布局
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical" > <android.support.v7.widget.RecyclerView android:id="@+id/id_rv_orders" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout>
就能够自适应item数量高度spa