java.lang.Object | |
↳ | android.content.res.TypedArray |
Container for an array of values that were retrieved with obtainStyledAttributes(AttributeSet, int[], int, int) or obtainAttributes(AttributeSet, int[]). Be sure to call recycle() when done with them. The indices used to retrieve values from this structure correspond to the positions of the attributes given to obtainStyledAttributes.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieve the boolean value for the attribute at index.
| |||||||||||
Retrieve the color value for the attribute at index.
| |||||||||||
Retrieve the ColorStateList for the attribute at index.
| |||||||||||
Retrieve a dimensional unit attribute at index.
| |||||||||||
Retrieve a dimensional unit attribute at index for use
as an offset in raw pixels.
| |||||||||||
Retrieve a dimensional unit attribute at index for use
as a size in raw pixels.
| |||||||||||
Retrieve the Drawable for the attribute at index.
| |||||||||||
Retrieve the float value for the attribute at index.
| |||||||||||
Retrieve a fractional unit attribute at index.
| |||||||||||
Return an index in the array that has data.
| |||||||||||
Return the number of indices in the array that actually have data.
| |||||||||||
Retrieve the integer value for the attribute at index.
| |||||||||||
Retrieve the integer value for the attribute at index.
| |||||||||||
Special version of getDimensionPixelSize(int, int) for retrieving
ViewGroup's layout_width and layout_height
attributes.
| |||||||||||
Special version of getDimensionPixelSize(int, int) for retrieving
ViewGroup's layout_width and layout_height
attributes.
| |||||||||||
Retrieve the string value for the attribute at index, but
only if that string comes from an immediate value in an XML file.
| |||||||||||
Returns a message about the parser state suitable for printing error messages.
| |||||||||||
Retrieve the resource identifier for the attribute at
index.
| |||||||||||
Return the Resources object this array was loaded from.
| |||||||||||
Retrieve the string value for the attribute at index.
| |||||||||||
Retrieve the styled string value for the attribute at index.
| |||||||||||
Retrieve the CharSequence[] for the attribute at index.
| |||||||||||
Retrieve the raw TypedValue for the attribute at index.
| |||||||||||
Determines whether there is an attribute at index.
| |||||||||||
Return the number of values in this array.
| |||||||||||
Retrieve the raw TypedValue for the attribute at index
and return a temporary object holding its data.
| |||||||||||
Give back a previously retrieved StyledAttributes, for later re-use.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Retrieve the boolean value for the attribute at index.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined. |
Retrieve the color value for the attribute at index. If the attribute references a color resource holding a complex ColorStateList, then the default color from the set is returned.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Retrieve the ColorStateList for the attribute at index. The value may be either a single solid color or a reference to a color or complex ColorStateList description.
index | Index of attribute to retrieve. |
---|
Retrieve a dimensional unit attribute at index. Unit conversions are based on the current DisplayMetrics associated with the resources this TypedArray object came from.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Retrieve a dimensional unit attribute at index for use as an offset in raw pixels. This is the same as getDimension(int, float), except the returned value is converted to integer pixels for you. An offset conversion involves simply truncating the base value to an integer.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Retrieve a dimensional unit attribute at index for use as a size in raw pixels. This is the same as getDimension(int, float), except the returned value is converted to integer pixels for use as a size. A size conversion involves rounding the base value, and ensuring that a non-zero base value is at least one pixel in size.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Retrieve the Drawable for the attribute at index. This gets the resource ID of the selected attribute, and uses Resources.getDrawable of the owning Resources object to retrieve its Drawable.
index | Index of attribute to retrieve. |
---|
Retrieve the float value for the attribute at index.
index | Index of attribute to retrieve. |
---|
Retrieve a fractional unit attribute at index.
index | Index of attribute to retrieve. |
---|---|
base | The base value of this fraction. In other words, a standard fraction is multiplied by this value. |
pbase | The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by this value. |
defValue | Value to return if the attribute is not defined or not a resource. |
Return an index in the array that has data.
at | The index you would like to returned, ranging from 0 to getIndexCount(). |
---|
Return the number of indices in the array that actually have data.
Retrieve the integer value for the attribute at index.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined. |
Retrieve the integer value for the attribute at index.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Special version of getDimensionPixelSize(int, int) for retrieving ViewGroup's layout_width and layout_height attributes. This is only here for performance reasons; applications should use getDimensionPixelSize(int, int).
index | Index of the attribute to retrieve. |
---|---|
defValue | The default value to return if this attribute is not default or contains the wrong type of data. |
Special version of getDimensionPixelSize(int, int) for retrieving ViewGroup's layout_width and layout_height attributes. This is only here for performance reasons; applications should use getDimensionPixelSize(int, int).
index | Index of the attribute to retrieve. |
---|---|
name | Textual name of attribute for error reporting. |
Retrieve the string value for the attribute at index, but only if that string comes from an immediate value in an XML file. That is, this does not allow references to string resources, string attributes, or conversions from other types. As such, this method will only return strings for TypedArray objects that come from attributes in an XML file.
index | Index of attribute to retrieve. |
---|
Returns a message about the parser state suitable for printing error messages.
Retrieve the resource identifier for the attribute at index. Note that attribute resource as resolved when the overall TypedArray object is retrieved. As a result, this function will return the resource identifier of the final resource value that was found, not necessarily the original resource that was specified by the attribute.
index | Index of attribute to retrieve. |
---|---|
defValue | Value to return if the attribute is not defined or not a resource. |
Return the Resources object this array was loaded from.
Retrieve the string value for the attribute at index.
index | Index of attribute to retrieve. |
---|
Retrieve the styled string value for the attribute at index.
index | Index of attribute to retrieve. |
---|
Retrieve the CharSequence[] for the attribute at index. This gets the resource ID of the selected attribute, and uses Resources.getTextArray of the owning Resources object to retrieve its String[].
index | Index of attribute to retrieve. |
---|
Retrieve the raw TypedValue for the attribute at index.
index | Index of attribute to retrieve. |
---|---|
outValue | TypedValue object in which to place the attribute's data. |
Determines whether there is an attribute at index.
index | Index of attribute to retrieve. |
---|
Retrieve the raw TypedValue for the attribute at index and return a temporary object holding its data. This object is only valid until the next call on to TypedArray.
index | Index of attribute to retrieve. |
---|
Give back a previously retrieved StyledAttributes, for later re-use.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())