Window win = getDialog().getWindow();
// 一定要設(shè)置Background,如果不設(shè)置,window屬性設(shè)置無效。
win.setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams params = win.getAttributes();
params.gravity = Gravity.BOTTOM;
// 使用ViewGroup.LayoutParams,以便Dialog 寬度充滿整個屏幕
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
win.setAttributes(params);