Search code examples
androidscroll-offset

Android: ListView.getScrollY() - does it work?


I am using it, but it always returns 0, even though I have scrolled till the end of the list.


Solution

  • getScrollY() is actually a method on View, not ListView. It is referring to the scroll amount of the entire view, so it will almost always be 0.

    If you want to know how far the ListView's contents are scrolled, you can use listView.getFirstVisiblePosition();