private int estimateContentSize(){
  int total=0;
  int count=0;
  for (int i=mAdapter.getItemCount() - 1; i >= 0 && count < mConfig.viewCountEstimateSize; i--) {
    View view=mLayoutManager.findViewByPosition(i + 1);
    if (view != null) {
      Rect rect=new Rect();
      mLayoutManager.getDecoratedBoundsWithMargins(view,rect);
      int itemHeight=Math.abs(directionVertical() ? rect.height() : rect.width());
      count++;
      total+=itemHeight;
    }
  }
  if (count > 0) {
    double average=(double)total / count;
    return (int)(average * mAdapter.getItemCount());
  }
  return 0;
}

private int estimateContentSize ( ) { int total = 0 ; int count = 0 ; for ( int i = mAdapter . getItemCount ( ) - 1 ; i >= 0 && count < mConfig . viewCountEstimateSize ; i -- ) { View view = mLayoutManager . findViewByPosition ( i + 1 ) ; if ( view != null ) { Rect rect = new Rect ( ) ; mLayoutManager . getDecoratedBoundsWithMargins ( view , rect ) ; int itemHeight = Math . abs ( directionVertical ( ) ? rect . height ( ) : rect . width ( ) ) ; count ++ ; total += itemHeight ; } } if ( count > 0 ) { double average = ( double ) total / count ; return ( int ) ( average * mAdapter . getItemCount ( ) ) ; } return 0 ; }
try to estimate the content size of the adapter inside the recyclerview .
