setDuration

Sets the duration for the underlying animator that animates the requested properties.
By default, the animator uses the default value for ValueAnimator. Calling this method
will cause the declared value to be used instead.

Parameters

value

long: The length of ensuing property animations, in milliseconds. The value
cannot be negative.

setInterpolator

Sets the interpolator for the underlying animator that animates the requested properties.
By default, the animator uses the default interpolator for ValueAnimator. Calling this method
will cause the declared object to be used instead.

Parameters

value

Interpolator: The TimeInterpolator to be used for ensuing property animations.

setStartDelay

Sets the startDelay for the underlying animator that animates the requested properties.
By default, the animator uses the default value for ValueAnimator. Calling this method
will cause the declared value to be used instead.

Parameters

value

long: The delay of ensuing property animations, in milliseconds. The value
cannot be negative.

start

Starts the currently pending property animations immediately. Calling start()
is optional because all animations start automatically at the next opportunity. However,
if the animations are needed to start immediately and synchronously (not at the time when
the next event is processed by the hierarchy, which is when the animations would begin
otherwise), then this method can be used.

withEndAction

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:

withLayer

The View associated with this ViewPropertyAnimator will have its
layer type set to
LAYER_TYPE_HARDWARE for the duration of the next animation.
As stated in the documentation for LAYER_TYPE_HARDWARE,
the actual type of layer used internally depends on the runtime situation of the
view. If the activity and this view are hardware-accelerated, then the layer will be
accelerated as well. If the activity or the view is not accelerated, then the layer will
effectively be the same as LAYER_TYPE_SOFTWARE.

This state is not persistent, either on the View or on this ViewPropertyAnimator: the
layer type of the View will be restored when the animation ends to what it was when this
method was called, and this setting on ViewPropertyAnimator is only valid for the next
animation. Note that calling this method and then independently setting the layer type of
the View (by a direct call to
setLayerType(int, android.graphics.Paint)) will result in some
inconsistency, including having the layer type restored to its pre-withLayer()
value when the animation ends.

For API 14 and 15, this method will run by setting
a listener on the ViewPropertyAnimatorCompat object, setting a hardware layer in
the listener's onAnimationStart(View) method,
and then restoring the orignal layer type in the listener's
onAnimationEnd(View) method.

withStartAction

Specifies an action to take place when the next animation runs. If there is a
startDelay set on this ViewPropertyAnimator, then the
action will run after that startDelay expires, when the actual animation begins.
This method, along with withEndAction(Runnable), is intended to help facilitate
choreographing ViewPropertyAnimator animations with other animations or actions
in the application.

For API 14 and 15, this method will run by setting
a listener on the ViewPropertyAnimatorCompat object and running the action
in that listener's onAnimationStart(View) method.