Refer to this
According to Android platform developer Dianne Hackborn in this group discussion column, Dialogs set the width and height of the top-level layout of the WRAP_CONTENT window. To make the Dialog bigger, you can set these parameters to FILL_PARENT.
Demo code:
AlertDialog.Builder adb = new AlertDialog.Builder(this); Dialog d = adb.setView(new View(this)).create();
Note that the attributes are set after the dialog box is displayed. The system is very complex when they are installed. (I assume that the layout engine should install them the first time the dialog is displayed, or something like that.)
It would be better to do this by expanding the .Dialog theme, then you would not have to play a fortunetelling game about when to call setAttributes. (Although itโs a bit more work to make the dialog automatically accept the corresponding light or dark theme or Honeycomb Holo theme. This can be done according to http://developer.android.com/guide/topics/ui/themes.html#SelectATheme )
user647826 Jan 12 2018-12-12T00: 00Z
source share