我只想在屏幕上显示Webview的队列。为了避免在webview中加载html时出现黑屏,我想使用z-index预先加载webview或使用send来预览即将发布的webview .....
答案 0 :(得分:0)
这不是最好的解决方案,但是当他加载新网址时显示Progres对话框的内容是什么?我
WebView mWeb;
ProgressDialog mProgress;
mWeb = your web view id
// set Javascript
WebSettings settings = mWeb.getSettings();
settings.setJavaScriptEnabled(true);
// the init state of progress dialog
mProgress = ProgressDialog.show(this, "Loading", "Please wait for a moment...");
// add a WebViewClient for WebView, which actually handles loading data from web
mWeb.setWebViewClient(new WebViewClient() {
// load url
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
// when finish loading page
public void onPageFinished(WebView view, String url) {
if(mProgress.isShowing()) {
mProgress.dismiss();
}
}
});
// set url for webview to load
mWeb.loadUrl("http://www.saharplus.com");
}
答案 1 :(得分:0)
例如:你可以这样使用。
为您的活动添加示例代码
// OTHER CODE STUFF
mWeb.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
Webview wView=(Webview) view;
Imageview.setVisibility(View.GONE);
wView.setvisibility(View.VISIBLE);
}
});
*在手机上输入任何拼写错误:/