private void setWindowSize(double multipleofWindowHeight,double multipleofWindowWidth) {
WindowManager windowManager = this.getWindowManager();
Display display = windowManager.getDefaultDisplay();
LayoutParams params = getWindow().getAttributes();
params.height = (int)(display.getHeight()*multipleofWindowHeight);
params.width = (int)(display.getWidth()*multipleofWindowWidth);
getWindow().setAttributes(params);
}multipleofWindowHeight = 1.0;multipleofWindowWidth = 0.8;
本文介绍了一种通过指定窗口高度和宽度的倍数来调整窗口大小的方法。使用了WindowManager、Display以及LayoutParams等API来实现这一功能。
2830

被折叠的 条评论
为什么被折叠?



