File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2095,8 +2095,13 @@ protected int computeVerticalScrollOffset() {
20952095 int height = view .getHeight ();
20962096 if (height > 0 ) {
20972097 final int numColumns = mNumColumns ;
2098- final int whichRow = mFirstPosition / numColumns ;
20992098 final int rowCount = (mItemCount + numColumns - 1 ) / numColumns ;
2099+ // In case of stackFromBottom the calculation of whichRow needs
2100+ // to take into account that counting from the top the first row
2101+ // might not be entirely filled.
2102+ final int oddItemsOnFirstRow = isStackFromBottom () ? ((rowCount * numColumns ) -
2103+ mItemCount ) : 0 ;
2104+ final int whichRow = (mFirstPosition + oddItemsOnFirstRow ) / numColumns ;
21002105 return Math .max (whichRow * 100 - (top * 100 ) / height +
21012106 (int ) ((float ) mScrollY / getHeight () * rowCount * 100 ), 0 );
21022107 }
You can’t perform that action at this time.
0 commit comments