首页 > 其他 > 详细

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

时间:2018-12-15 18:35:57      阅读:188      评论:0      收藏:0      [点我收藏+]

在最近项目中遇到 ,在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数量高度

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

原文:https://www.cnblogs.com/zty-Love/p/10124150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!