重写自定义Dialog的show()方法
@Override public void show() { super.show(); /** * 设置宽度全屏,要设置在show的后面 */ WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.gravity= Gravity.BOTTOM; layoutParams.width= WindowManager.LayoutParams.MATCH_PARENT; layoutParams.height= WindowManager.LayoutParams.WRAP_CONTENT; getWindow().getDecorView().setPadding(0, 0, 0, 0); getWindow().setAttributes(layoutParams); }