Created
December 29, 2013 10:29
-
-
Save Hackforid/8169153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int getActionBarHeight() { | |
int actionBarHeight = getSupportActionBar().getHeight(); | |
if (actionBarHeight != 0) | |
return actionBarHeight; | |
final TypedValue tv = new TypedValue(); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) | |
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); | |
} else if (getTheme().resolveAttribute(com.actionbarsherlock.R.attr.actionBarSize, tv, true)) | |
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); | |
return actionBarHeight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment