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