Partager via


ViewPropertyAnimator.WithEndAction(IRunnable) Method

Definition

Specifies an action to take place when the next animation ends.

[Android.Runtime.Register("withEndAction", "(Ljava/lang/Runnable;)Landroid/view/ViewPropertyAnimator;", "GetWithEndAction_Ljava_lang_Runnable_Handler")]
public virtual Android.Views.ViewPropertyAnimator WithEndAction (Java.Lang.IRunnable? runnable);
[<Android.Runtime.Register("withEndAction", "(Ljava/lang/Runnable;)Landroid/view/ViewPropertyAnimator;", "GetWithEndAction_Ljava_lang_Runnable_Handler")>]
abstract member WithEndAction : Java.Lang.IRunnable -> Android.Views.ViewPropertyAnimator
override this.WithEndAction : Java.Lang.IRunnable -> Android.Views.ViewPropertyAnimator

Parameters

runnable
IRunnable

The action to run when the next animation ends.

Returns

This object, allowing calls to methods in this class to be chained.

Attributes

Remarks

Specifies an action to take place when the next animation ends. The action is only run if the animation ends normally; if the ViewPropertyAnimator is canceled during that animation, the runnable will not run. This method, along with #withStartAction(Runnable), is intended to help facilitate choreographing ViewPropertyAnimator animations with other animations or actions in the application.

For example, the following code animates a view to x=200 and then back to 0:

Runnable endAction = new Runnable() {
                    public void run() {
                        view.animate().x(0);
                    }
                };
                view.animate().x(200).withEndAction(endAction);

Java documentation for android.view.ViewPropertyAnimator.withEndAction(java.lang.Runnable).

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