how to get the end of html page in android webview
i'm displaying a web page in android webview. and i want to trigger a message when t开发者_开发百科he user reaches end of page while scrolling. how can i do that? TIA
One way is we can write custom MyWebView class that extends WebView and then we can use the function called computeHorizontalScrollRange() orcomputeVirticalScrollRange() to get the scroll range of webview.
AFAIK, I don't think there is any event that triggers this. But here's one way - you will have to try and see if it works though. Have a ListView
with two rows - one having the WebViewClient
and another just an ordinary TextView
- You could use something like SackOfViewsAdapter
for this.
In your adapter's getView()
, when the function is called to display the bottom TextView
, that's your cue on the user having scrolled down.
精彩评论