GradientDrawable.SetUseLevel(Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets whether this drawable's level
property will be used to
scale the gradient.
[Android.Runtime.Register("setUseLevel", "(Z)V", "GetSetUseLevel_ZHandler")]
public virtual void SetUseLevel (bool useLevel);
[<Android.Runtime.Register("setUseLevel", "(Z)V", "GetSetUseLevel_ZHandler")>]
abstract member SetUseLevel : bool -> unit
override this.SetUseLevel : bool -> unit
Parameters
- useLevel
- Boolean
true
if the gradient should be scaled based on
level, false
otherwise
- Attributes
Remarks
Sets whether this drawable's level
property will be used to scale the gradient. If a gradient is not used, this property has no effect.
Scaling behavior varies based on gradient type: <ul> <li>#LINEAR_GRADIENT
adjusts the ending position along the gradient's axis of orientation (see #getOrientation()
) <li>#RADIAL_GRADIENT
adjusts the outer radius <li>#SWEEP_GRADIENT
adjusts the ending angle <ul>
The default value for this property is false
.
<strong>Note</strong>: This property corresponds to the android:useLevel
attribute on the inner <gradient>
tag, NOT the android:useLevel
attribute on the outer <shape>
tag. For example,
{@code
<shape ...>
<gradient
...
android:useLevel="true" />
</shape>
}
<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.setUseLevel(boolean)
.
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.