How to set DialogFragment’s width and height?

If you convert directly from resources values: int width = getResources().getDimensionPixelSize(R.dimen.popup_width); int height = getResources().getDimensionPixelSize(R.dimen.popup_height); getDialog().getWindow().setLayout(width, height); Then specify match_parent in your layout for the dialog: android:layout_width=”match_parent” android:layout_height=”match_parent” You only have to worry about one place (place it in your DialogFragment#onResume). Its not perfect, but at least it works for having a RelativeLayout as the … Read more