Display display = getWindowManager().getDefaultDisplay(); // 为获取屏幕宽、高

Window window = getWindow();

LayoutParams windowLayoutParams = window.getAttributes(); // 获取对话框当前的参数值

windowLayoutParams.width = (int) (display.getWidth() * 1); // 宽度设置为屏幕的0.95

windowLayoutParams.height = (int) (display.getHeight() * 0.2); // 高度设置为屏幕的0.6

windowLayoutParams.alpha = 0.5f;// 设置透明度