how to show progress bar on webview?

后端 未结 5 1655
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-14 00:38

I am trying to open a webpage in my application using WebView. When I open webpage it shows me blank screen for a while and then open that page in browser insid

5条回答
  •  粉色の甜心
    2020-12-14 01:43

    Here is the code that I am using:

    Inside WebViewClient:

    webView.setWebViewClient(new WebViewClient() {
    
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            findViewById(R.id.progress1).setVisibility(View.VISIBLE);
        }
    
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            findViewById(R.id.progress1).setVisibility(View.GONE);
        }
    
    });
    

    Here is the XML :

    
    

    Hope this helps..

提交回复
热议问题