flexbox-layout icon indicating copy to clipboard operation
flexbox-layout copied to clipboard

FlexboxLayoutManager ROW NOWRAP, child layout top is wrong when RecyclerView has horizontal padding

Open laishere opened this issue 2 years ago • 0 comments

Issues and steps to reproduce

recyclerView.xml

<androidx.recyclerview.widget.RecyclerView
  android:layout_width="match_parent"
  android:layout_height="50dp"
  android:paddingHorizontal="14dp"
  />

item.xml

<TextView
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  android:gravity="bottom"
  android:text="@{title}"
  android:textSize="14sp"
  android:background="#f00"
  />

bug on release 3.0.0 FlexboxLayoutManager.java

// 1. line 1470
int childTop = layoutState.mOffset;

// 2. line 1745
mLayoutState.mOffset = anchorInfo.mCoordinate;

// 3. line 1138
anchorInfo.mCoordinate = mOrientationHelper.getStartAfterPadding()
                    + mPendingScrollPositionOffset;

The above code result in:

childTop = mOffset = mCoordinate = rv.paddingStart;

Expected behavior

childTop should be 0 at this case.

Version of the flexbox library

3.0.0

Link to code

As described above.

laishere avatar May 03 '22 06:05 laishere