Skip to content

Instantly share code, notes, and snippets.

View billyjoker's full-sized avatar

Guillermo billyjoker

View GitHub Profile
@billyjoker
billyjoker / height.java
Created November 14, 2018 16:27 — forked from hamakn/height.java
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(