Skip to content

Instantly share code, notes, and snippets.

@huangcd
Created April 9, 2015 07:02
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 huangcd/447e455ed3467c5f4e1d to your computer and use it in GitHub Desktop.
Save huangcd/447e455ed3467c5f4e1d to your computer and use it in GitHub Desktop.
get staus bar of Android's height
public static int getStatusBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment