Created
September 29, 2013 09:58
-
-
Save ikew0ng/6751104 to your computer and use it in GitHub Desktop.
获得ActionBar高度
This file contains hidden or 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
/** | |
* Get actionbar height | |
*/ | |
public static int getActionBarHeight(Context context) { | |
TypedValue typedValue = new TypedValue(); | |
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) { | |
return typedValue.complexToDimensionPixelSize(typedValue.data, context.getResources() | |
.getDisplayMetrics()); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment