Skip to content

Instantly share code, notes, and snippets.

@XinyueZ
Created August 24, 2014 12:15
Show Gist options
  • Select an option

  • Save XinyueZ/63db20f537ed24673949 to your computer and use it in GitHub Desktop.

Select an option

Save XinyueZ/63db20f537ed24673949 to your computer and use it in GitHub Desktop.
Get ActionBar's height.
/* Get ActionBar's height. */
int[] abSzAttr;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
abSzAttr = new int[]{android.R.attr.actionBarSize};
} else {
abSzAttr = new int[]{R.attr.actionBarSize};
}
TypedArray a = obtainStyledAttributes(abSzAttr);
mActionBarHeight = a.getDimensionPixelSize(0, -1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment