I am trying to build my own grid view functions - extending on the GridView
.
The only thing I cannot solve is how to get the current scroll position of the
I did not find any good solution, but this one is at least able to maintain the scroll position kind of pixel-perfectly:
int offset = (int)( * getResources().getDisplayMetrics().density);
int index = mGrid.getFirstVisiblePosition();
final View first = container.getChildAt(0);
if (null != first) {
offset -= first.getTop();
}
// Destroy the position through rotation or whatever here!
mGrid.setSelection(index);
mGrid.scrollBy(0, offset);
By that you can not get an absolute scroll position, but a visible item + displacement pair.
NOTES:
Hope that helps and gives you an idea.