private void setFullscreen(){
int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setFlags(flag, flag);
}
private int getTitleBarHeight(){
int contentTop;
contentTop = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
return contentTop-getStatusBarHeight();
}
private int getStatusBarHeight() {
Resources resources = this.getResources();
int resourceId = resources.getIdentifier("status_bar_height", "dimen","android");
int height = resources.getDimensionPixelSize(resourceId);
return height;
}
private int getNavigationBarHeight() {
Resources resources = this.getResources();
int resourceId = resources.getIdentifier("navigation_bar_height","dimen", "android");
int height = resources.getDimensionPixelSize(resourceId);
return height;
}
private int getScreenHeight(){
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);//this指当前activity
return dm.heightPixels;
}
private int getDecorviewHeight(){
return getWindow().getDecorView().getHeight();
}
private int getContentHeight(){
return getWindow().findViewById(Window.ID_ANDROID_CONTENT).getHeight();
}
int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setFlags(flag, flag);
}
private int getTitleBarHeight(){
int contentTop;
contentTop = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
return contentTop-getStatusBarHeight();
}
private int getStatusBarHeight() {
Resources resources = this.getResources();
int resourceId = resources.getIdentifier("status_bar_height", "dimen","android");
int height = resources.getDimensionPixelSize(resourceId);
return height;
}
private int getNavigationBarHeight() {
Resources resources = this.getResources();
int resourceId = resources.getIdentifier("navigation_bar_height","dimen", "android");
int height = resources.getDimensionPixelSize(resourceId);
return height;
}
private int getScreenHeight(){
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);//this指当前activity
return dm.heightPixels;
}
private int getDecorviewHeight(){
return getWindow().getDecorView().getHeight();
}
private int getContentHeight(){
return getWindow().findViewById(Window.ID_ANDROID_CONTENT).getHeight();
}