Activity的窗口大小,其本质还是通过windowManager来操作,WindowManger将其作为一个window来控制大小
WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay();
android.view.WindowManager.LayoutParams p = getWindow().getAttributes();
p.height = (int)(d.getHeight() *0.8);
p.width = (int)(d.getWidth()*0.7);
p.dimAmount = 0.0f;
getWindow().setAttributes(p);
时间: 2024-10-10 01:17:30