Skip to content

Instantly share code, notes, and snippets.

@ryancford
Created December 8, 2015 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryancford/23dffa81ce289345cb56 to your computer and use it in GitHub Desktop.
Save ryancford/23dffa81ce289345cb56 to your computer and use it in GitHub Desktop.
Returns the height of the status bar in pixels.
public static int getStatusBarHeight() {
int result = 0;
int resourceId = mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = mContext.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment