Partager via


Resources.GetColor Method

Definition

Overloads

GetColor(Int32)

Returns a color integer associated with a particular resource ID.

GetColor(Int32, Resources+Theme)

Returns a color integer associated with a particular resource ID.

GetColor(Int32)

Returns a color integer associated with a particular resource ID.

[Android.Runtime.Register("getColor", "(I)I", "GetGetColor_IHandler")]
public virtual Android.Graphics.Color GetColor (int id);
[<Android.Runtime.Register("getColor", "(I)I", "GetGetColor_IHandler")>]
abstract member GetColor : int -> Android.Graphics.Color
override this.GetColor : int -> Android.Graphics.Color

Parameters

id
Int32

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A single color value in the form 0xAARRGGBB.

Attributes

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Returns a color integer associated with a particular resource ID. If the resource holds a complex ColorStateList, then the default color from the set is returned.

This member is deprecated. Use #getColor(int, Theme) instead.

Java documentation for android.content.res.Resources.getColor(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

GetColor(Int32, Resources+Theme)

Returns a color integer associated with a particular resource ID.

[Android.Runtime.Register("getColor", "(ILandroid/content/res/Resources$Theme;)I", "GetGetColor_ILandroid_content_res_Resources_Theme_Handler", ApiSince=23)]
public virtual Android.Graphics.Color GetColor (int id, Android.Content.Res.Resources.Theme? theme);
[<Android.Runtime.Register("getColor", "(ILandroid/content/res/Resources$Theme;)I", "GetGetColor_ILandroid_content_res_Resources_Theme_Handler", ApiSince=23)>]
abstract member GetColor : int * Android.Content.Res.Resources.Theme -> Android.Graphics.Color
override this.GetColor : int * Android.Content.Res.Resources.Theme -> Android.Graphics.Color

Parameters

id
Int32

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A single color value in the form 0xAARRGGBB.

Attributes

Remarks

Java documentation for android.content.res.Resources.getColor(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