WebView - show dialog when user clicks a link
I have an activity with a WebView. When the activity loads, I show an alert message which I dismiss on "onPageFinished" event.
What I need to do know, is show a ProgressBar when the user clicked on a link and the webview is loading it, and dismiss it when the loading is over. Similar to iPhone behaviour.
Is it possible?开发者_StackOverflow中文版
10X :) Udi
This is described in the documentation:
final Activity activity = this;
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
activity.setProgress(progress * 1000);
}
});
See also here.
精彩评论