dialog要改变其在window中的大小不同于普通的view,下面直接上代码
//在dialog.show()之后调用
public static void setDialogWindowAttr(Dialog dlg,Context ctx){
Window window = dlg.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.CENTER;
lp.width = LayoutParams.MATH_PARENT;//宽高可设置具体大小
lp.height = LayoutParams.MATH_PARENT;
dlg.getWindow().setAttributes(lp);
}