先看效果
主要代碼
Window window = dialog.getWindow();
window.setBackgroundDrawable(null); // 注意,沒有這一行對話框是沒法填充屏幕的
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(window.getAttributes());
lp.windowAnimations = R.style.SlideDialogAnimation;
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM; // 設(shè)置位置為屏幕底部
window.setAttributes(lp);
參考
http://stackoverflow.com/questions/18315343/android-make-a-dialog-appear-in-fullscreen