Skip to content

Instantly share code, notes, and snippets.

@arunavo4
Forked from stephenparish/GetStatusBarHeight.java
Created October 15, 2018 14:18
Show Gist options
  • Save arunavo4/c01fa33a785ab05abdbd5ef4cecb3b32 to your computer and use it in GitHub Desktop.
Save arunavo4/c01fa33a785ab05abdbd5ef4cecb3b32 to your computer and use it in GitHub Desktop.
Get android status bar height
public int getStatusBarHeight() {
int result = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = getResources().getDimensionPixelSize(resourceId);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment