webのロード中は、ProgressDialogを表示させておく。
final ProgressDialog progress_dialog = new ProgressDialog(this); progress_dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progress_dialog.setMessage(getString(R.string.dialog_loading_data)); progress_dialog.show(); final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.webview_dialog); dialog.setTitle(getString(R.string.dialog_title)); dialog.setCancelable(true); WebView webview = (WebView)dialog.findViewById(R.id.webview); webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webview.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); progress_dialog.dismiss(); dialog.show(); } }); webview.loadUrl("Dialogに表示するwebのURL");
DialogにセットするViewのlayoutファイル(R.layout.webview_dialog)は以下の通り