Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 全屏显示带有webview的AlertDialog_Android - Fatal编程技术网

Android 全屏显示带有webview的AlertDialog

Android 全屏显示带有webview的AlertDialog,android,Android,在我的应用程序中,我正在webview中加载一个google文档url,并将该webview显示为警报对话框的一部分。以下是我正在使用的代码: AlertDialog.Builder alert = new AlertDialog.Builder( MockExamActivity.this); alert.setTitle(R.string.writing_title); We

在我的应用程序中,我正在webview中加载一个google文档url,并将该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);
但我看到的是:


你知道如何让对话框占据整个屏幕空间吗?

你可以使用自定义对话框并将非对话框主题设置为相同的,例如
android.R.style.theme
android.R.style.theme\u Light

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

AlertDialog.Builder alert=新建AlertDialog.Builder(mockexactivity.this,android.R.style.Theme);仍然会产生相同的屏幕大小。这可能是因为谷歌文档url吗?@Sandeep尝试使用自定义对话框而不是alertdialog。查看链接和dianne hackborn的评论谢谢它救了我一天。。