Search code examples
javaandroiddialogfragment

Android get rid of DialogFragment floating margin


I'm displaying a dialogfragment in my app and I notice that even when I set the fragments' y position to the bottom of the screen there's still a margin visible:

        Display display = getActivity().getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        windowParams.y = size.y;

In the below screenshot you can see that the light blue (my dialogfragment) is still appearing some distance away from the bottom of the screen despite being set to the bottom of the screen. How do I remove this margin?

margins


Solution

  • The solution is to add this line:

    setStyle(DialogFragment.STYLE_NO_FRAME, 0);