Skip to content

Instantly share code, notes, and snippets.

View jungletian's full-sized avatar
💭
I may be slow to respond.

ZhangTitanjum jungletian

💭
I may be slow to respond.
View GitHub Profile
@jungletian
jungletian / getStatusBarHeight
Created August 11, 2017 03:45
the height of status bar
public static int getStatusBarHeight(Context context) {
int statusBarHeight = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = context.getResources().getDimensionPixelSize(resourceId);
}
return statusBarHeight;
}