Rect rect = new Rect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int top = rect.top; //状态栏高度
View view = getWindow().findViewById(Window.ID_ANDROID_CONTENT);
int top2 = view.getTop();//状态栏标题校栏的总高度,top2-top 为标题高度
int width = view.getWidth(); //用户区宽度
int height = view.getHeight(); //用户区高度
Display mDisplay = getWindowManager().getDefaultDisplay();
int width = mDisplay.getWidth(); //屏幕宽度
int height = mDisplay.getHeight(); //屏幕高度