devunwired/recyclerview-playground

Padding doubled in FixedTwoWayList on first layout

Closed this issue · 2 comments

Hi Dave,
there is a problem when adding a padding to the RecyclerView and with the FixedGridLayoutManager.

Steps to reproduce:
Add a padding to the Recyclerview in fragment_recycler.xml eg.:

android:padding="30dp"
android:clipToPadding="false"

Start the app, select "Fixed Two-Way List" and then "Large Grid"
The padding is now double the size is should be.
When you start to scroll it jumps back to the correct padding.

I was able to fix it by changing line 263 in FixedGridLayoutManager.java to:
fillGrid(DIRECTION_NONE, 0, 0, recycler, state, removedCache);
but I am not sure about any other effects this might have.

Best regards,
Stephan

Okay, this is not a fix, it has the effect of scrolling the RecyclerView when the first layout is done at another position (eg. coming back from another activity).

Thanks for reporting this, I've pushed a fix. The padding should have only been taken into account during an initial layout phase (when the positions would otherwise be zero), and not on every fill.