Android getting exact scroll position in ListView

Okay, I found a workaround, using the following code:

View c = listview.getChildAt(0);
int scrolly = -c.getTop() + listview.getFirstVisiblePosition() * c.getHeight();

The way it works is it takes the actual offset of the first visible list item and calculates how far it is from the top of the view to determine how much we are “scrolled into” the view, so now that we know that we can calculate the rest using the regular getFirstVisiblePosition method.

Leave a Comment