Created
August 6, 2014 14:48
-
-
Save markus2610/0933e98e82a20541f06b to your computer and use it in GitHub Desktop.
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
| public static int getDimensionForName(String resourceName, Context ctx) { | |
| int result = 0; | |
| int resourceId = ctx.getResources().getIdentifier(resourceName, "dimen", "android"); | |
| if (resourceId > 0) { | |
| result = ctx.getResources().getDimensionPixelSize(resourceId); | |
| } | |
| return result; | |
| } | |
| public static int getNotificationBarHeight(Context ctx) { | |
| return getDimensionForName("status_bar_height", ctx); | |
| } | |
| public static int getNavigationBarHeight(Context ctx) { | |
| return getDimensionForName("navigation_bar_height", ctx); | |
| } | |
| public static int getActionBarHeight(Context ctx) { | |
| return (int) ctx.getResources().getDimension(R.dimen.abc_action_bar_default_height); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment