public final class ResourceHelper extends Object
Constructor | Description |
---|---|
ResourceHelper() |
Modifier and Type | Method | Description |
---|---|---|
static int |
getColor(String value) |
Returns the color value represented by the given string value
|
static int |
getColorType(String value) |
Returns the TypedValue color type represented by the given string value
|
static int |
getInternalResourceId(String idName) |
|
static TypedValue |
getValue(String attribute,
String value,
boolean requireUnit) |
Returns the raw value from the given attribute float-type value string.
|
static boolean |
parseFloatAttribute(String attribute,
String value,
TypedValue outValue,
boolean requireUnit) |
Parse a float attribute and return the parsed value into a given TypedValue.
|
public static int getColor(String value)
value
- the color valueNumberFormatException
- if the conversion failed.public static int getColorType(String value)
value
- the color valuepublic static int getInternalResourceId(String idName)
public static TypedValue getValue(String attribute, String value, boolean requireUnit)
ResourceHelper
.attribute
- Attribute name.value
- Attribute value.requireUnit
- whether the value is expected to contain a unit.public static boolean parseFloatAttribute(String attribute, String value, TypedValue outValue, boolean requireUnit)
attribute
- the name of the attribute. Can be null if requireUnit is false.value
- the string value of the attributeoutValue
- the TypedValue to receive the parsed valuerequireUnit
- whether the value is expected to contain a unit.