I'm trying to get the background of a DialogFragment
to be completely clear.
With setting the style item android:windowIsFloating
to true (the default),
the DialogFragment
displays exactly how I want it to, but has a very dimmed background.
By setting android:windowIsFloating
to false, I get the clear background I want, but the DialogFragment blows up to about 95% of the screen,
leaving only a tiny gap around it where you can see through to the view it overlays.
I've tried ton's of tweaks and cannot seem to override this behavior.
Do I need to use a PopupWindow
to achieve the desired effects, or are there some style
items that I can override ?
You need to get a handle to your DialogFrament (sometime after .show is called), and do this in a Posted Runnable:
I got it from Aleks G's answer to Changing position of the Dialog on screen android .
Create your own Customized dialog extends with
FragmentDailog
and override this methodNOTE: This answer works for me in case of
DialogFragment
andBottomSheetDialogFragment
What works for me is to adjust the
WinowManager.LayoutParams
inonStart()
of the DialogFragment:Even a simpler solution is to change the style in the onCreate of the DialogFragment: