I'm new using CordovaWebView and I have the following problem

When I try to load content into CordovaWebView, first it shows an empty white screen for sometime until it loads it's content.

What I want is to show native loading screen until the CordovaWebView finish loading it's content

Can anyone help here ?

有帮助吗?

解决方案

You can override the cordovaWebviewClient present in cordova lib and implement "onPageStarted" and "onPageFinished" methods. In pagestart make progress bar visiblity to visible and on page finish make it to gone.

 public void onPageStarted(WebView view, String url, Bitmap favicon) {
      // TODO Auto-generated method stub
      super.onPageStarted(view, url, favicon);

            progressBar.setVisibility(View.GONE);
     }

     public void onPageFinished(WebView view, String url) {
  // TODO Auto-generated method stub
      super.onPageFinished(view, url);

      progressBar.setVisibility(View.GONE);
     }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top