//取得狀態列高度
int statusBarHeight = 0; int resource = this.getResources().getIdentifier("status_bar_height",
"dimen", "android"); if (resource > 0) { statusBarHeight = this.getResources().getDimensionPixelSize(resource); }
//取得標題列高度
int actionBarHeight=0; TypedValue tv = new TypedValue(); if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
getResources().getDisplayMetrics()); }
//應用區域高度
Rect outRect1 = new Rect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect1);
//VIEW繪製區域高度
Rect outRect2 = new Rect();
getWindow().findViewById(Window.ID_ANDROID_CONTENT).getDrawingRect(outRect2);