dialog想改变默认宽度,横向全屏,要在show之后,修改Attributes,
其中
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
必不可少,不加此行,DecorView会有padding,横向一直不能铺满屏幕
Window window = getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.CENTER;
lp.width = WindowManager.LayoutParams.MATCH_PARENT;//宽高可设置具体大小
getWindow().setAttributes(lp);
// 此行必不可少
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));