I have a problem with a fragment dialog, if the phone is on portrait mode, everything is ok, the dialog is almost full screen, but when I rotate my phone, in landscape there are some big gaps on the sides..is possible to fix this problem?
I call this
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
To get rid of the DIalogFragment title. I'm using a Linear Layout.
The solution:
@Override
public void onStart()
{
super.onStart();
Dialog dialog = getDialog();
if (dialog != null)
{
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width, height);
}
}
Add this to your dialog fragment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With