这是我的代码, 码: http://pastebin.com/cHVThsR5
我在这里有旋转器,但旋转器一直在旋转。如何让应用知道页面加载完成?毕竟让旋转器看不见?
答案 0 :(得分:1)
你需要做这样的事情:
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
pb.setVisibility(View.GONE);
}
});
答案 1 :(得分:1)
您是否尝试过手动隐身?
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