Aracılığıyla paylaş


GradientDrawable.SetColors Method

Definition

Overloads

SetColors(Int32[], Single[])

Sets the colors and offsets used to draw the gradient.

SetColors(Int32[])

Sets the colors used to draw the gradient.

SetColors(Int32[], Single[])

Sets the colors and offsets used to draw the gradient.

[Android.Runtime.Register("setColors", "([I[F)V", "GetSetColors_arrayIarrayFHandler", ApiSince=29)]
public virtual void SetColors (int[]? colors, float[]? offsets);
[<Android.Runtime.Register("setColors", "([I[F)V", "GetSetColors_arrayIarrayFHandler", ApiSince=29)>]
abstract member SetColors : int[] * single[] -> unit
override this.SetColors : int[] * single[] -> unit

Parameters

colors
Int32[]

an array containing 2 or more ARGB colors

offsets
Single[]

optional array of floating point parameters representing the positions of the colors. Null evenly disperses the colors

Attributes

Remarks

Sets the colors and offsets used to draw the gradient.

Each color is specified as an ARGB integer and the array must contain at least 2 colors.

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

Java documentation for android.graphics.drawable.GradientDrawable.setColors(int[], float[]).

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

SetColors(Int32[])

Sets the colors used to draw the gradient.

[Android.Runtime.Register("setColors", "([I)V", "GetSetColors_arrayIHandler")]
public virtual void SetColors (int[]? colors);
[<Android.Runtime.Register("setColors", "([I)V", "GetSetColors_arrayIHandler")>]
abstract member SetColors : int[] -> unit
override this.SetColors : int[] -> unit

Parameters

colors
Int32[]

an array containing 2 or more ARGB colors

Attributes

Remarks

Sets the colors used to draw the gradient.

Each color is specified as an ARGB integer and the array must contain at least 2 colors.

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

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