获取手机屏幕区域高度
public int getWindowArea() {
Display display = getWindowManager().getDefaultDisplay();
Point point = new Point();
display.getSize(point);
int width = point.x;
int height = point.y;
return height;
}
应用区域高度
public int getApplicationArea() {
Rect rect = new Rect();
getWindow().getDecorView().
getWindowVisibleDisplayFrame(rect);
int width = rect.width();
int height = rect.height();
return height;
}
获取view绘制区域高度
public int getDrawArea() {
Rect rect = new Rect();
getWindow().findViewById(Window.ID_ANDROID_CONTENT)
.getDrawingRect(rect);
int width = rect.width();
int height = rect.height();
return height;
}
时间: 2024-11-08 19:03:43