Distance between RecyclerView too far

In the custom_row_news_items.xml, android:layout_height="match_parent" should be android:layout_height="wrap_content. Because of match_parent, it is taking the space of the entire screen. Always remember that the single row for recyclerview should have height wrap_content if it has vertical layout.

You can also try to change the recyclerview height width parameters to

    android:layout_width="match_parent"
    android:layout_height="match_parent"

I am speculating that because your height is set to wrap content, it is only taking a single row. But with match_parent, it will accomodate as many as it can on the screen.


just change your parent layout height from being android:layout_height="match_parent" to android:layout_height="wrap_content and it will solve your problem, as your container of row layout has wrap_content and your row layout tries to match height of parent it will fill a full screen, and your single component has taken a full height of screen.

changes in row layout:

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

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Small Text"
        android:id="@+id/date_text"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true" />

    <ImageView
        android:src="@drawable/img"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/thumb_img"
        android:layout_below="@+id/date_text"
        android:layout_centerHorizontal="true" />

    <TextView
        android:background="#006699"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/title_text"
        android:layout_alignBottom="@+id/thumb_img"
        android:layout_centerHorizontal="true" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Medium Text"
        android:id="@+id/des_text"
        android:layout_below="@+id/thumb_img"
        android:layout_centerHorizontal="true" />
</RelativeLayout>