WebView getScrollY() always returns 0

android, android-webview

Solution

The site you linked has a fixed header. My guess is that the page itself doesn't scroll; a container inside it does. The `WebView` can't inspect every scrollable container on the page, so it sees that the top-level container doesn't scroll and assumes that the entire thing is fixed.

If all you need this for is pull-to-refresh, I'd recommend adding a refresh button in addition to the `SwipeRefreshLayout`.

Problem

Im trying to use the webview's scroll position to determine whether SwipeRefreshLayout should be able to refresh, except for some websites e.g. https://jobs.lever.co/memebox, getScrollY() always returns 0. Is there a way to ensure I will always get the correct scroll position?

Original source

Related problems