Empty space at the bottom
I just try version 3.0.2 when I scroll down to the bottom I found an empty space like this

I also add items at the start to show that empty space is still at the bottom
What I want to ask is, is this normal or I just did something wrong?
Setup layout
val layoutManager = SpannedGridLayoutManager(SpannedGridLayoutManager.Orientation.VERTICAL, 4)
layoutManager.spanSizeLookup = SpannedGridLayoutManager.SpanSizeLookup { position ->
when (position) {
0 -> SpanSize(4, 2)
1, 2 -> SpanSize(2, 2)
else -> SpanSize(1, 1)
}
}
layoutManager.itemOrderIsStable = true
MainActivity's layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</android.support.constraint.ConstraintLayout>
Item's layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="wrap_content"
xmlns:tools="http://schemas.android.com/tools">
<android.support.constraint.ConstraintLayout
android:id="@+id/item_layout_bg"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="H,1:1">
<TextView
android:id="@+id/item_layout_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="TEST"/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
It is an overscroll issue, it happens in horizontal mode too. I think there is some error in the scrollBy method and, more specifically, in how the end value is computed (the overscroll seems to be exactly one extra span).
Dear @manfcas,
do you have any news regarding the issue fixing?
I have the latest version 3.0.2 and I faced with the same bug.
Please recommend any suitable workaround if possible.
Thanks in advance, Dmitry
Try to override the scrollBy method and replace the line:
val end = layoutEnd + rectsHelper.itemSize + paddingEndLayout
with:
var end = 0
for (i in (state.itemCount - 1) downTo 0) {
val rect = childFrames[state.itemCount - 1]
if (rect != null) {
end = rect.right + paddingEndLayout
break
}
}
and the line:
if (scroll + size > end && (firstVisiblePosition + childCount + spans) >= state.itemCount) {
with:
if (end != 0 && scroll + size > end && (firstVisiblePosition + childCount + spans) >= state.itemCount) {
and let me know.