我剛剛將Android支持庫的新更新安裝到了版本23.2.1.0,並且當我運行該項目時,我遇到了一個前所未有的問題。我正在使用卡片視圖,這些視圖顯示在碎片內充氣的recyclerview容器內部。這些cardview在列表項目之間有很大的差距。所有recyclerviews似乎都有同樣的問題。回收站視圖之間的巨大差距
爲recyclerview容器中的代碼如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:scrollbars="vertical" />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:background="@drawable/ProgressBarStyle"
android:visibility="invisible" />
</RelativeLayout>
列表項的代碼如下:更新之前
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false"
android:id="@+id/cv">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<refractored.controls.CircleImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/person_photo"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"
android:src="@drawable/profile2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/person_name"
android:layout_toRightOf="@+id/person_photo"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:layout_alignParentTop="false"
android:textSize="20sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
一切都很好。我不知道爲什麼更新搞砸了一切。這就是列表項目現在的樣子。您將不得不上下滾動查看其他項目。
檢查http://stackoverflow.com/questions/35728179/recyclerview-items-with-big-empty-space-after-23-2-0 –