Search code examples
androidxmlandroid-layoutandroid-dialogfragment

Set DialogFragment bottom margin according to calling activity


I have a DialogFragment that gets called from 1 of 4 buttons from a certain activity. Currently I have paddingBottom set to 48dp (height of these buttons) so the dialog pops up right above these buttons. But I've encountered a problem where on a really high res phone there's a gap between the dialog's bottom and the row of buttons.

Is there any way to either programmatically or through XML set the dialog right on top of calling activity button's height?


Solution

  • I did manage to solve the problem with setting the RelativeLayout height to fill_parent instead of fixed 460dp size. All of the children now use match_parent for height.