Share via


GradientDrawable.SetColor Method

Definition

Overloads

SetColor(ColorStateList)

Changes this drawable to use a single color state list instead of a gradient.

SetColor(Int32)

Changes this drawable to use a single color instead of a gradient.

SetColor(ColorStateList)

Changes this drawable to use a single color state list instead of a gradient.

[Android.Runtime.Register("setColor", "(Landroid/content/res/ColorStateList;)V", "GetSetColor_Landroid_content_res_ColorStateList_Handler")]
public virtual void SetColor (Android.Content.Res.ColorStateList? colorStateList);
[<Android.Runtime.Register("setColor", "(Landroid/content/res/ColorStateList;)V", "GetSetColor_Landroid_content_res_ColorStateList_Handler")>]
abstract member SetColor : Android.Content.Res.ColorStateList -> unit
override this.SetColor : Android.Content.Res.ColorStateList -> unit

Parameters

colorStateList
ColorStateList

The color state list used to fill the shape

Attributes

Remarks

Changes this drawable to use a single color state list instead of a gradient. Calling this method with a null argument will clear the color and is equivalent to calling #setColor(int) with the argument Color#TRANSPARENT.

<strong>Note</strong>: changing color will affect all instances of a drawable loaded from a resource. It is recommended to invoke #mutate() before changing the color.

Java documentation for android.graphics.drawable.GradientDrawable.setColor(android.content.res.ColorStateList).

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

SetColor(Int32)

Changes this drawable to use a single color instead of a gradient.

[Android.Runtime.Register("setColor", "(I)V", "GetSetColor_IHandler")]
public virtual void SetColor (int argb);
[<Android.Runtime.Register("setColor", "(I)V", "GetSetColor_IHandler")>]
abstract member SetColor : int -> unit
override this.SetColor : int -> unit

Parameters

argb
Int32

The color used to fill the shape

Attributes

Remarks

Changes this drawable to use a single color instead of a gradient.

<strong>Note</strong>: changing color will affect all instances of a drawable loaded from a resource. It is recommended to invoke #mutate() before changing the color.

Java documentation for android.graphics.drawable.GradientDrawable.setColor(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.

See also

Applies to