RecyclerView 高度不能随着Item数量 自适应高度

在最近项目中遇到 ,在RecyclerView加载list数据时,高度无法自适应增长,看了很多博客,各种尝试,都没有解决这个问题,在某个博客中,讲到此解决方法,在此记录下。

即在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数量高度

posted @ 2018-12-15 17:59  zty_Love  阅读(5071)  评论(1编辑  收藏  举报