Partager via


Drawable.SetLevel(Int32) Method

Definition

Specify the level for the drawable.

[Android.Runtime.Register("setLevel", "(I)Z", "")]
public bool SetLevel (int level);
[<Android.Runtime.Register("setLevel", "(I)Z", "")>]
member this.SetLevel : int -> bool

Parameters

level
Int32

The new level, from 0 (minimum) to 10000 (maximum).

Returns

Returns true if this change in level has caused the appearance of the Drawable to change (hence requiring an invalidate), otherwise returns false.

Attributes

Remarks

Specify the level for the drawable. This allows a drawable to vary its imagery based on a continuous controller, for example to show progress or volume level.

If the new level you are supplying causes the appearance of the Drawable to change, then it is responsible for calling #invalidateSelf in order to have itself redrawn, <em>and</em> true will be returned from this function.

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

Applies to