According to the attached picture, I'm experiencing an empty space with exactly one page height at the above the recyclerview items.
Here is my recyclerview row layout:
<?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>
And this is my activity layout:
<?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" />
...
I also tried layout_height="match_parent"
for the recyclerview
but the only difference was the empty gap shown at the first without any scrolling.
Setting fixed height to the items also didn't change anything.
After updating the dependencies to recyclerview-v7:25.3.1
, I forced to change all row_items
's layout_height
from match_parent
to wrap_content
.
In this case I forgot to change the layout_height
of an item_row
layout which was my header
row of the recyclerview
.
Here is my recyclerview
header row that should have layout_height="wrap_content"
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">