android Activity 设置大小

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,UI)