DialogFragment with clear background (not dimmed)

What works for me is to adjust the WinowManager.LayoutParams in onStart() of the DialogFragment:

@Override public void onStart() {
    super.onStart();

    Window window = getDialog().getWindow();
    WindowManager.LayoutParams windowParams = window.getAttributes();
    windowParams.dimAmount = 0.90f;
    windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    window.setAttributes(windowParams);
}

Leave a Comment