WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕宽、高 android.view.WindowManager.LayoutParams p = getWindow().getAttributes(); //获取对话框当前的参数值 p.height = (int) (d.getHeight() * 0.7); //高度设置为屏幕的0.7 p.width = (int) (d.getWidth() * 0.7); //宽度设置为屏幕的0.7 getWindow().setAttributes(p); //设置生效 |
|
来自: 逍遥的砖头 > 《android开发》