TypedArray.GetColor(Int32, Int32) Method

Definition

Retrieve the color value for the attribute at <var>index</var>.

[Android.Runtime.Register("getColor", "(II)I", "GetGetColor_IIHandler")]
public virtual Android.Graphics.Color GetColor (int index, int defValue);
[<Android.Runtime.Register("getColor", "(II)I", "GetGetColor_IIHandler")>]
abstract member GetColor : int * int -> Android.Graphics.Color
override this.GetColor : int * int -> Android.Graphics.Color

Parameters

index
Int32

Index of attribute to retrieve.

defValue
Int32

Value to return if the attribute is not defined or not a resource.

Returns

Attribute color value, or defValue if not defined.

Attributes

Exceptions

if the TypedArray has already been recycled.

if the attribute is defined but is not an integer color or color state list.

Remarks

Retrieve the color value for the attribute at <var>index</var>. If the attribute references a color resource holding a complex android.content.res.ColorStateList, then the default color from the set is returned.

This method will throw an exception if the attribute is defined but is not an integer color or color state list.

Java documentation for android.content.res.TypedArray.getColor(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to