I am using an activity with the dialog theme set, and I want it to be full screen. I tried all sorts of things, even going through the WindowManager to expand the window to full width and height manually, but nothing works.
Apparently, a dialog window (or an activity with the dialog theme) will only expand according to its contents, but even that doesn't always work. For instance, I show a progress bar circle which has width and height set to FILL_PARENT (so does its layout container), but still, the dialog wraps around the much smaller progress bar instead of filling the screen.
There must be a way of displaying something small inside a dialog window but have it expand to full screen size without its content resizing as well?
Wrap your dialog_custom_layout.xml into RelativeLayout instead of any other layout.That worked for me.
This answer is a workaround for those who use "Theme.AppCompat.Dialog" or any other "Theme.AppCompat.Dialog" descendants like "Theme.AppCompat.Light.Dialog", "Theme.AppCompat.DayNight.Dialog", etc. I myself has to use AppCompat dialog because i use AppCompatActivity as extends for all my activities. There will be a problem that make the dialog has padding on every sides(top, right, bottom and left) if we use the accepted answer.
On your Activity's style, add these code
As you may notice, the problem that generate padding to our dialog is "android:windowBackground", so here i make the window background to null.
You may add this values to your style android:windowMinWidthMajor and android:windowMinWidthMinor
The minimum width the window is allowed to be, along the minor axis of the screen.
I just want to fill only 80% of the screen for that I did like this below
it works only when I put the getwindow().setLayout... line below the setContentView(..)
thanks @Matthias