开发者

how to get the end of html page in android webview

开发者 https://www.devze.com 2023-02-24 22:53 出处:网络
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? TIAOne way is we can write custom My

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消