android 自定义对话框宽不能占满父layout的解决办法

  dialog.setContentView(layout);
            Window dialogWindow = dialog.getWindow();
            WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            dialogWindow.setGravity(Gravity.CENTER);
            lp.width = LayoutParams.FILL_PARENT;
            dialogWindow.setAttributes(lp);
			return dialog;

你可能感兴趣的:(android)