Skip to content

Commit f51d920

Browse files
committed
Fix the view index used for stretching views. (#322)
Basically, it apply the same fix as another PR #304 to the method that stretches views.
1 parent 649a8d7 commit f51d920

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

flexbox/src/main/java/com/google/android/flexbox/FlexboxHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,16 +1560,15 @@ void stretchViews(int fromIndex) {
15601560
}
15611561
int flexDirection = mFlexContainer.getFlexDirection();
15621562
if (mFlexContainer.getAlignItems() == AlignItems.STRETCH) {
1563-
int viewIndex = fromIndex;
15641563
int flexLineIndex = 0;
15651564
if (mIndexToFlexLine != null) {
15661565
flexLineIndex = mIndexToFlexLine[fromIndex];
15671566
}
15681567
List<FlexLine> flexLines = mFlexContainer.getFlexLinesInternal();
15691568
for (int i = flexLineIndex, size = flexLines.size(); i < size; i++) {
15701569
FlexLine flexLine = flexLines.get(i);
1571-
for (int j = 0, itemCount = flexLine.mItemCount; j < itemCount;
1572-
j++, viewIndex++) {
1570+
for (int j = 0, itemCount = flexLine.mItemCount; j < itemCount; j++) {
1571+
int viewIndex = flexLine.mFirstIndex + j;
15731572
if (j >= mFlexContainer.getFlexItemCount()) {
15741573
continue;
15751574
}

0 commit comments

Comments
 (0)