在java代码中只需要写入设置窗口的方法就好了。
private void showDialog() {
final AlertDialog dialog = new AlertDialog.Builder(this).create()
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.show()
Window window = dialog.getWindow()
window.getDecorView().setPadding(0, 0, 0, 0)
window.setGravity(Gravity.CENTER)
window.setContentView(R.layout.abc)
WindowManager.LayoutParams lp = window.getAttributes()
lp.width = WindowManager.LayoutParams.FILL_PARENT
lp.height = WindowManager.LayoutParams.FILL_PARENT
window.setAttributes(lp)
}
如此就能弹出全屏的dialog了。