Fragment of dialogue, fill screen

I have a problem with the fragment dialog box, if the phone is in portrait mode, everything is fine, the dialogue is almost in full screen mode, but when I turn my phone around, large gaps appear on the sides of the landscape. can this problem be solved?

enter image description here

I call it

getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); 

To get rid of the name DIalogFragment. I am using Linear Layout.

+5
source share
1 answer

Decision:

 @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 snippet of dialogue.

+3
source

Source: https://habr.com/ru/post/1208505/


All Articles