开发者

WebView - show dialog when user clicks a link

开发者 https://www.devze.com 2023-03-16 14:42 出处:网络
I have an activity with a WebView. When the activity loads, I show an alert message which I dismiss on \"onPageFinished\" event.

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.

0

精彩评论

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