Skip to content

Commit ca0b870

Browse files
imhappihunterstich
authored andcommitted
[Carousel] Recyclerview children do not inherit layout direction
PiperOrigin-RevId: 729275138
1 parent 4ed648a commit ca0b870

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/java/com/google/android/material/carousel/CarouselLayoutManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ private void addViewsStart(Recycler recycler, int startPosition) {
457457
continue;
458458
}
459459
View child = recycler.getViewForPosition(i);
460-
measureChildWithMargins(child, 0, 0);
461460
// Add this child to the first index of the RecyclerView.
462461
addAndLayoutView(
463462
child, /* index= */ 0, new ChildCalculations(child, center, offsetCenter, range));
@@ -509,7 +508,6 @@ private void addViewsEnd(Recycler recycler, State state, int startPosition) {
509508
continue;
510509
}
511510
View child = recycler.getViewForPosition(i);
512-
measureChildWithMargins(child, 0, 0);
513511
// Add this child to the last index of the RecyclerView
514512
addAndLayoutView(
515513
child, /* index= */ -1, new ChildCalculations(child, center, offsetCenter, range));
@@ -602,6 +600,7 @@ private ChildCalculations makeChildCalculations(Recycler recycler, float start,
602600
private void addAndLayoutView(View child, int index, ChildCalculations calculations) {
603601
float halfItemSize = currentKeylineState.getItemSize() / 2F;
604602
addView(child, index);
603+
measureChildWithMargins(child, 0, 0);
605604
int start = (int) (calculations.offsetCenter - halfItemSize);
606605
int end = (int) (calculations.offsetCenter + halfItemSize);
607606
orientationHelper.layoutDecoratedWithMargins(child, start, end);

0 commit comments

Comments
 (0)