Created
December 8, 2015 02:25
-
-
Save ryancford/87656ef51842b3aa163a to your computer and use it in GitHub Desktop.
Returns dimension size in pixels for a given Theme Attribute.
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
public static int getThemeAttributeDimensionSize(Context context, int attr) | |
{ | |
TypedArray a = null; | |
try{ | |
a = context.getTheme().obtainStyledAttributes(new int[] { attr }); | |
return a.getDimensionPixelSize(0, 0); | |
}finally{ | |
if(a != null){ | |
a.recycle(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment