Share via


GradientDrawable.SetGradientCenter(Single, Single) Method

Definition

Sets the position of the center of the gradient as a fraction of the width and height.

[Android.Runtime.Register("setGradientCenter", "(FF)V", "GetSetGradientCenter_FFHandler")]
public virtual void SetGradientCenter (float x, float y);
[<Android.Runtime.Register("setGradientCenter", "(FF)V", "GetSetGradientCenter_FFHandler")>]
abstract member SetGradientCenter : single * single -> unit
override this.SetGradientCenter : single * single -> unit

Parameters

x
Single

the X-position of the center of the gradient

y
Single

the Y-position of the center of the gradient

Attributes

Remarks

Sets the position of the center of the gradient as a fraction of the width and height.

The default value is (0.5, 0.5).

<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.setGradientCenter(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.

Applies to

See also