0

I just installed the new updates for Android support library to version 23.2.1.0 and when I ran the project, I'm facing an issue that wasn't there before. I'm using card views that are displayed inside the recyclerview container which is inflated inside the fragments. These cardviews have wide gaps between the list items. All the recyclerviews seem to have the same issue.

The code for the recyclerview container is as follows:

<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>

The code for the list item is below:

<?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>

Everything was fine before the update. I have n clue why the update messed everything up. This is how the list items appear now. You will have to scroll up and down to view other items.

enter image description here

Ahmed Mujtaba
  • 2,110
  • 5
  • 36
  • 67

1 Answers1

3

Try setting the height of the rootLinearLayout in your listItem xml to wrap_content.

Ravi Theja
  • 3,371
  • 1
  • 22
  • 34
  • Oh yeah. That solved it. Thanks dude! In the previous version, the full height of the main wrapper wasn't shown, only the inside contents were being displayed in the recycle listview. – Ahmed Mujtaba Apr 07 '16 at 04:54
  • Omg, this saved me. Thank you so much. But what's the explanation? – Recomer Jun 20 '16 at 17:18