Skip to content

Instantly share code, notes, and snippets.

@Ubhadiyap
Forked from jackgris/ActionBarHeight.java
Created September 14, 2017 12:43
Show Gist options
  • Save Ubhadiyap/e2a44fc3af56b6b4a6a29606a3ce4a25 to your computer and use it in GitHub Desktop.
Save Ubhadiyap/e2a44fc3af56b6b4a6a29606a3ce4a25 to your computer and use it in GitHub Desktop.
How get height of ActionBarCompact
// Get height action bar compat
TypedValue tv = new TypedValue();
int attr = android.support.v7.appcompat.R.attr.actionBarSize;
if (getTheme().resolveAttribute(attr, tv, true)){
int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
Log.w("ACTIONBAR", "height - " + actionBarHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment