android获取导航栏Navigation高度
/* * 获取底部栏的高度 */ public int getNavigationHeight(Context context) { if (context == null) { return 0; } if(checkHasNavigationBar(context)){ //这个函数请查看上一片文章 return 0; } Resources resources = context.getResources(); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); int height = 0; if (resourceId > 0) { //获取NavigationBar的高度 height = resources.getDimensionPixelSize(resourceId); } return height; }