dialog.show();
//之后进行
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.width = (int) (display.getWidth()); //设置宽度
dialog.getWindow().setAttributes(lp);