解決ScrollView嵌套RecyclerView顯示不全

在ScrollView嵌套ListVIew、GirdView的時候都會出現顯示不全的情況,對于這種情況只需要重寫ListView和GridView的高度即可。
  在Android6.0以下,ScrollView嵌套RecyclerView并不會出現顯示不全的問題,但是在Android6.0及以上版本使用這種布局嵌套的時候就會出現RecyclerView顯示不全的問題,解決方法很簡單,只需要在RecyclerView的外面套上一層RelativeLayout即可,代碼如下:

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:descendantFocusability="blocksDescendants">

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/gv_goods_list"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"/>
                </RelativeLayout>
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容