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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM