Last active
August 29, 2015 14:24
-
-
Save dmitriy-chernysh/6bcfbc917829fc35415b to your computer and use it in GitHub Desktop.
Android getting ActionBar height
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
/** | |
* Method for getting height of Actionbar | |
* @param context Application context | |
* @return height | |
*/ | |
public static int getActionBarHeight(Context context){ | |
TypedValue tv = new TypedValue(); | |
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) | |
{ | |
return TypedValue.complexToDimensionPixelOffset(tv.data, context.getResources().getDisplayMetrics()); | |
} else { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment