WindowManager m = Getwindowmanager (); Display d = m.getdefaultdisplay (); To get the screen width, high android.view.WindowManager.LayoutParams p = Dialog.getwindow (). GetAttributes (); Gets the current parameter value of the dialog box p.height = (int) (D.getheight ()); The height is set to the screen p.width = (int) (D.getwidth ()); The width is set to the Dialog.getwindow () of the screen. SetAttributes (P);
This setting does not work.
Infodialog Infodialog = new Infodialog (context, r.style.resulterrdialog);
Windowmanager.layoutparams LP = Infodialog.getwindow (). GetAttributes ();
Infodialog.getwindow (). setgravity (Gravity.bottom);
Window win = Infodialog.getwindow ();
Win.getdecorview (). setpadding (0, 0, 0, 0);
Lp.width = WindowManager.LayoutParams.FILL_PARENT;
Lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
Win.setattributes (LP);
Infodialog.show ();
This dialog the same width as the screen.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Dialog is full