Skip to content

Instantly share code, notes, and snippets.

@ksu3101
Created June 23, 2016 06:35
Show Gist options
  • Save ksu3101/a2c0cbfd76f1aca75a1b24866c1d7569 to your computer and use it in GitHub Desktop.
Save ksu3101/a2c0cbfd76f1aca75a1b24866c1d7569 to your computer and use it in GitHub Desktop.
안드로이드 하단 Navigation bar 가 존재 시 높이를 얻는 메소드. (없을 경우 0을 반환)
/**
* 하단 Navigation bar의 높이를 얻는다.
*
* @param context Context instance
* @return pixel size of bottom of Navigation bar height or 0
*/
public static int getNavigationBarHeight(Context context) {
if (context != null) {
int statusBarHeightResourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (statusBarHeightResourceId > 0) {
return context.getResources().getDimensionPixelSize(statusBarHeightResourceId);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment