/**
* 获取导航栏高度
*/
public static int getNavigationBarHeight(Context context){
int navigationBarHeight = 0;
int resourceId =
context.getResources().getIdentifier("navigation_bar_height", "dimen", "android")
if (resourceId > 0) {
navigationBarHeight = context.getResources().getDimensionPixelSize(resourceId)
}
return navigationBarHeight;
}
/**
* 获取状态栏高度
*/
public static int getStatusBarHeight(Context context){
int statusBarHeight = 0;
int resourceId =
context.getResources().getIdentifier("status_bar_height", "dimen", "android")
if (resourceId > 0) {
statusBarHeight = context.getResources().getDimensionPixelSize(resourceId)
}
return statusBarHeight;
}
做一个笔记