Partager via


GradientDrawable.SetStroke Method

Definition

Overloads

SetStroke(Int32, Color, Single, Single)

Set the stroke width and color for the drawable.

SetStroke(Int32, ColorStateList, Single, Single)

Set the stroke width and color state list for the drawable.

SetStroke(Int32, ColorStateList)

Set the stroke width and color state list for the drawable.

SetStroke(Int32, Color)

Set the stroke width and color for the drawable.

SetStroke(Int32, Color, Single, Single)

Set the stroke width and color for the drawable.

[Android.Runtime.Register("setStroke", "(IIFF)V", "GetSetStroke_IIFFHandler")]
public virtual void SetStroke (int width, Android.Graphics.Color color, float dashWidth, float dashGap);
[<Android.Runtime.Register("setStroke", "(IIFF)V", "GetSetStroke_IIFFHandler")>]
abstract member SetStroke : int * Android.Graphics.Color * single * single -> unit
override this.SetStroke : int * Android.Graphics.Color * single * single -> unit

Parameters

width
Int32

The width in pixels of the stroke

color
Color

The color of the stroke

dashWidth
Single

The length in pixels of the dashes, set to 0 to disable dashes

dashGap
Single

The gap in pixels between dashes

Attributes

Remarks

Set the stroke width and color for the drawable. If width is zero, then no stroke is drawn. This method can also be used to dash the stroke.

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

Java documentation for android.graphics.drawable.GradientDrawable.setStroke(int, int, float, 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.

See also

  • <xref:Android.Graphics.Drawables.GradientDrawable.SetStroke(System.Int32%2c+Android.Graphics.Color)>

Applies to

SetStroke(Int32, ColorStateList, Single, Single)

Set the stroke width and color state list for the drawable.

[Android.Runtime.Register("setStroke", "(ILandroid/content/res/ColorStateList;FF)V", "GetSetStroke_ILandroid_content_res_ColorStateList_FFHandler")]
public virtual void SetStroke (int width, Android.Content.Res.ColorStateList? colorStateList, float dashWidth, float dashGap);
[<Android.Runtime.Register("setStroke", "(ILandroid/content/res/ColorStateList;FF)V", "GetSetStroke_ILandroid_content_res_ColorStateList_FFHandler")>]
abstract member SetStroke : int * Android.Content.Res.ColorStateList * single * single -> unit
override this.SetStroke : int * Android.Content.Res.ColorStateList * single * single -> unit

Parameters

width
Int32

The width in pixels of the stroke

colorStateList
ColorStateList

The color state list of the stroke

dashWidth
Single

The length in pixels of the dashes, set to 0 to disable dashes

dashGap
Single

The gap in pixels between dashes

Attributes

Remarks

Set the stroke width and color state list for the drawable. If width is zero, then no stroke is drawn. This method can also be used to dash the stroke.

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

Java documentation for android.graphics.drawable.GradientDrawable.setStroke(int, android.content.res.ColorStateList, float, 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.

See also

  • <xref:Android.Graphics.Drawables.GradientDrawable.SetStroke(System.Int32%2c+Android.Content.Res.ColorStateList)>

Applies to

SetStroke(Int32, ColorStateList)

Set the stroke width and color state list for the drawable.

[Android.Runtime.Register("setStroke", "(ILandroid/content/res/ColorStateList;)V", "GetSetStroke_ILandroid_content_res_ColorStateList_Handler")]
public virtual void SetStroke (int width, Android.Content.Res.ColorStateList? colorStateList);
[<Android.Runtime.Register("setStroke", "(ILandroid/content/res/ColorStateList;)V", "GetSetStroke_ILandroid_content_res_ColorStateList_Handler")>]
abstract member SetStroke : int * Android.Content.Res.ColorStateList -> unit
override this.SetStroke : int * Android.Content.Res.ColorStateList -> unit

Parameters

width
Int32

The width in pixels of the stroke

colorStateList
ColorStateList

The color state list of the stroke

Attributes

Remarks

Set the stroke width and color state list for the drawable. If width is zero, then no stroke is drawn.

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

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

See also

  • <xref:Android.Graphics.Drawables.GradientDrawable.SetStroke(System.Int32%2c+Android.Content.Res.ColorStateList%2c+Android.Content.Res.ColorStateList%2c+Android.Content.Res.ColorStateList)>

Applies to

SetStroke(Int32, Color)

Set the stroke width and color for the drawable.

[Android.Runtime.Register("setStroke", "(II)V", "GetSetStroke_IIHandler")]
public virtual void SetStroke (int width, Android.Graphics.Color color);
[<Android.Runtime.Register("setStroke", "(II)V", "GetSetStroke_IIHandler")>]
abstract member SetStroke : int * Android.Graphics.Color -> unit
override this.SetStroke : int * Android.Graphics.Color -> unit

Parameters

width
Int32

The width in pixels of the stroke

color
Color

The color of the stroke

Attributes

Remarks

Set the stroke width and color for the drawable. If width is zero, then no stroke is drawn.

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

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

See also

  • <xref:Android.Graphics.Drawables.GradientDrawable.SetStroke(System.Int32%2c+Android.Graphics.Color%2c+Android.Graphics.Color%2c+Android.Graphics.Color)>

Applies to