Jack Dsilva Jack Dsilva - 1 year ago 94
Android Question

How to show a progress bar for a layout until the WebView is loaded

I am loading a WebView to the LinearLayout and want to display a ProgressBar inside this layout until the WebView is fully loaded.I wnet through the below links and they seems to be really great but I do not want to use ProgressDialog, instead I would like to use progressbar inside the layout.


how to show progress bar on webview?

How would I do that?

Say for example,


I would like to display a progressbar until the page gets displayed.

Answer Source

You can simply use the webView setPictureListener() like this:

// here you can start a loading wheel

   webView.setPictureListener(new WebView.PictureListener() {
      public void onNewPicture(WebView webView, Picture picture) {
           // close your loading wheel here

   //load your url