2
根据附图,我正在遇到一个空白区域,在回收站查看项目上方有一个页面高度。
Android RecyclerView在上述项目上有空白
这里是我的recyclerview排布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white">
...
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
这是我的活动布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/list_toolbar"
layout="@layout/toolbar_list"></include>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical" />
...
我也试过layout_height="match_parent"
为recyclerview
,但唯一的区别是空的差距第一个显示没有任何滚动。
设置项目的固定高度也没有改变任何东西。