简体   繁体   中英

How to use spinner in webview?

Here is my code, Code: http://pastebin.com/cHVThsR5

I am having the spinner here but the spinner keeps rotating. How do I let the app know that the page load is finished? and after all making the spinner invisible?

you will need to do something like this:

webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);

                pb.setVisibility(View.GONE);

        }
 });

Did you try making it invisible manually?

 if (isInternetPresent) {
            ImageView NoInt=(ImageView) findViewById(R.id.NoInternet);
            NoInt.setVisibility(View.GONE);
            ProgressBar pb = this.findViewById(R.id.progressBar); //Get a reference to your ProgressBar


            WebView webView = (WebView) findViewById(R.id.webview);
            WebSettings webSettings = webView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            webView.setWebViewClient(new WebViewClient());
            webView.loadUrl("http://glocalkhabar.com");
            pb.setVisibility(View.GONE); //Make it invisible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM