2

私のアプリでは、Google ドキュメントの URL を webview に読み込んでおり、その webview をアラート ダイアログの一部として表示しています。以下は私が使用しているコードです:

            AlertDialog.Builder alert = new AlertDialog.Builder(
                    MockExamActivity.this);


            alert.setTitle(R.string.writing_title);

            WebView wv = new WebView(MockExamActivity.this);
            wv.getSettings().setJavaScriptEnabled(true);
            wv.loadUrl("https://docs.google.com/file/d/string/edit?usp=sharing");
            wv.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view,
                        String url) {
                    view.loadUrl(url);

                    return true;
                }
            });

            alert.setNegativeButton("Close",
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id) {
                        }
                    });
            Dialog d = alert.setView(wv).create();
            d.show();
            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
            lp.copyFrom(d.getWindow().getAttributes());
            lp.width = WindowManager.LayoutParams.FILL_PARENT;
            lp.height = WindowManager.LayoutParams.FILL_PARENT;
            d.getWindow().setAttributes(lp);

しかし、私が見ているのは次のとおりです。

ここに画像の説明を入力

ダイアログを全画面スペースにするにはどうすればよいですか?

4

1 に答える 1

5

android.R.style.Themeカスタム ダイアログを使用して、ダイアログ以外のテーマをやなどと同じに設定できますandroid.R.style.Theme_Light

 Dialog dialog=new Dialog(ActivityName.this,android.R.style.Theme);

https://groups.google.com/forum/#!topic/android-developers/NDFo9pF8sHY

于 2013-09-04T17:06:12.187 に答える