Skip to content

Instantly share code, notes, and snippets.

@mightyfrog
Created April 15, 2015 14:42
Show Gist options
  • Save mightyfrog/2160432248ed62c39ed8 to your computer and use it in GitHub Desktop.
Save mightyfrog/2160432248ed62c39ed8 to your computer and use it in GitHub Desktop.
Define float values in res/values
<resources>
    <item name="float1" format="float" type="dimen">1.0</item>
    <item name="float2" format="float" type="dimen">0.95</item>
</resources>
final TypedValue typedValue = new TypedValue();
getResources().getValue(R.dimen.flaot1, typedValue, true);
final float value1 = typedValue.getFloat();
getResources().getValue(R.dimen.flaot2, typedValue, true);
final float value2 = typedValue.getFloat();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment