I have a DialogFragment
with an xml layout and I need it to be, let\'s say 75% as wide as the screen. When I look for answers I always find the common weight<
I don't think it is possible to achieve this without using code.
Anyway I'm using this code inside my custom DialogFragment class. Hope it helps.
public void onResume() {
super.onResume();
Window window = getDialog().getWindow();
Point size = new Point();
Display display = window.getWindowManager().getDefaultDisplay();
display.getSize(size);
int width = size.x;
window.setLayout((int) (width * 0.75), WindowManager.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);
}