我有WebView和ProgressDialog,它的显示类似于进度条,当页面加载它的节目时。
onPageStarted - > dialog.show();
onPageFinished - > dialog.dismiss();
现在,我想在加载webview之前制作“启动画面”。
一位朋友告诉我通过创建 -
来引起轰动// LAYOUT FILE
ImageView
android:visibility =“visible”
网页视图 android:visibility =“gone”
// java FILE
onPageFinished - > myWebView.setVisibility(View.VISIBLE);
问题是是否可以隐藏第一个加载对话框, 它隐藏了照片Splash
这是我的setWebViewClient:
view.setWebViewClient(new WebViewClient() {
ProgressDialog dialog = new ProgressDialog(MainActivity.this);
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
// TODO Auto-generated method stub
dialog.setMessage("loading...");
dialog.dismiss();
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
myWebView.setVisibility(View.VISIBLE);
dialog.dismiss();
super.onPageFinished(view, url);
}
});