@@ -457,7 +457,6 @@ private void addViewsStart(Recycler recycler, int startPosition) {
457
457
continue ;
458
458
}
459
459
View child = recycler .getViewForPosition (i );
460
- measureChildWithMargins (child , 0 , 0 );
461
460
// Add this child to the first index of the RecyclerView.
462
461
addAndLayoutView (
463
462
child , /* index= */ 0 , new ChildCalculations (child , center , offsetCenter , range ));
@@ -509,7 +508,6 @@ private void addViewsEnd(Recycler recycler, State state, int startPosition) {
509
508
continue ;
510
509
}
511
510
View child = recycler .getViewForPosition (i );
512
- measureChildWithMargins (child , 0 , 0 );
513
511
// Add this child to the last index of the RecyclerView
514
512
addAndLayoutView (
515
513
child , /* index= */ -1 , new ChildCalculations (child , center , offsetCenter , range ));
@@ -602,6 +600,7 @@ private ChildCalculations makeChildCalculations(Recycler recycler, float start,
602
600
private void addAndLayoutView (View child , int index , ChildCalculations calculations ) {
603
601
float halfItemSize = currentKeylineState .getItemSize () / 2F ;
604
602
addView (child , index );
603
+ measureChildWithMargins (child , 0 , 0 );
605
604
int start = (int ) (calculations .offsetCenter - halfItemSize );
606
605
int end = (int ) (calculations .offsetCenter + halfItemSize );
607
606
orientationHelper .layoutDecoratedWithMargins (child , start , end );
0 commit comments