ViewPropertyAnimatorCompat

public final class ViewPropertyAnimatorCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.ViewPropertyAnimatorCompat


Summary

Public methods

ViewPropertyAnimatorCompat alpha(float value)

This method will cause the View's alpha property to be animated to the specified value.

ViewPropertyAnimatorCompat alphaBy(float value)

This method will cause the View's alpha property to be animated by the specified value.

void cancel()

Cancels all property animations that are currently running or pending.

long getDuration()

Returns the current duration of property animations.

Interpolator getInterpolator()

Returns the timing interpolator that this animation uses.

long getStartDelay()

Returns the current startDelay of property animations.

ViewPropertyAnimatorCompat rotation(float value)

This method will cause the View's rotation property to be animated to the specified value.

ViewPropertyAnimatorCompat rotationBy(float value)

This method will cause the View's rotation property to be animated by the specified value.

ViewPropertyAnimatorCompat rotationX(float value)

This method will cause the View's rotationX property to be animated to the specified value.

ViewPropertyAnimatorCompat rotationXBy(float value)

This method will cause the View's rotationX property to be animated by the specified value.

ViewPropertyAnimatorCompat rotationY(float value)

This method will cause the View's rotationY property to be animated to the specified value.

ViewPropertyAnimatorCompat rotationYBy(float value)

This method will cause the View's rotationY property to be animated by the specified value.

ViewPropertyAnimatorCompat scaleX(float value)

This method will cause the View's scaleX property to be animated to the specified value.

ViewPropertyAnimatorCompat scaleXBy(float value)

This method will cause the View's scaleX property to be animated by the specified value.

ViewPropertyAnimatorCompat scaleY(float value)

This method will cause the View's scaleY property to be animated to the specified value.

ViewPropertyAnimatorCompat scaleYBy(float value)

This method will cause the View's scaleY property to be animated by the specified value.

ViewPropertyAnimatorCompat setDuration(long value)

Sets the duration for the underlying animator that animates the requested properties.

ViewPropertyAnimatorCompat setInterpolator(Interpolator value)

Sets the interpolator for the underlying animator that animates the requested properties.

ViewPropertyAnimatorCompat setListener(ViewPropertyAnimatorListener listener)

Sets a listener for events in the underlying Animators that run the property animations.

ViewPropertyAnimatorCompat setStartDelay(long value)

Sets the startDelay for the underlying animator that animates the requested properties.

ViewPropertyAnimatorCompat setUpdateListener(ViewPropertyAnimatorUpdateListener listener)

Sets a listener for update events in the underlying Animator that runs the property animations.

void start()

Starts the currently pending property animations immediately.

ViewPropertyAnimatorCompat translationX(float value)

This method will cause the View's translationX property to be animated to the specified value.

ViewPropertyAnimatorCompat translationXBy(float value)

This method will cause the View's translationX property to be animated by the specified value.

ViewPropertyAnimatorCompat translationY(float value)

This method will cause the View's translationY property to be animated to the specified value.

ViewPropertyAnimatorCompat translationYBy(float value)

This method will cause the View's translationY property to be animated by the specified value.

ViewPropertyAnimatorCompat translationZ(float value)

This method will cause the View's translationZ property to be animated to the specified value.

ViewPropertyAnimatorCompat translationZBy(float value)

This method will cause the View's translationZ property to be animated by the specified value.

ViewPropertyAnimatorCompat withEndAction(Runnable runnable)

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

ViewPropertyAnimatorCompat withLayer()

The View associated with this ViewPropertyAnimator will have its layer type set to View.LAYER_TYPE_HARDWARE for the duration of the next animation.

ViewPropertyAnimatorCompat withStartAction(Runnable runnable)

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

ViewPropertyAnimatorCompat x(float value)

This method will cause the View's x property to be animated to the specified value.

ViewPropertyAnimatorCompat xBy(float value)

This method will cause the View's x property to be animated by the specified value.

ViewPropertyAnimatorCompat y(float value)

This method will cause the View's y property to be animated to the specified value.

ViewPropertyAnimatorCompat yBy(float value)

This method will cause the View's y property to be animated by the specified value.

ViewPropertyAnimatorCompat z(float value)

This method will cause the View's z property to be animated to the specified value.

ViewPropertyAnimatorCompat zBy(float value)

This method will cause the View's z property to be animated by the specified value.

Inherited methods

Public methods

alpha

public ViewPropertyAnimatorCompat alpha (float value)

This method will cause the View's alpha property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

alphaBy

public ViewPropertyAnimatorCompat alphaBy (float value)

This method will cause the View's alpha property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

cancel

public void cancel ()

Cancels all property animations that are currently running or pending.

getDuration

public long getDuration ()

Returns the current duration of property animations. If the duration was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Returns
long The duration of animations, in milliseconds.

See also:

getInterpolator

public Interpolator getInterpolator ()

Returns the timing interpolator that this animation uses.

Returns
Interpolator The timing interpolator for this animation.

getStartDelay

public long getStartDelay ()

Returns the current startDelay of property animations. If the startDelay was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Returns
long The startDelay of animations, in milliseconds.

rotation

public ViewPropertyAnimatorCompat rotation (float value)

This method will cause the View's rotation property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

rotationBy

public ViewPropertyAnimatorCompat rotationBy (float value)

This method will cause the View's rotation property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

rotationX

public ViewPropertyAnimatorCompat rotationX (float value)

This method will cause the View's rotationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

rotationXBy

public ViewPropertyAnimatorCompat rotationXBy (float value)

This method will cause the View's rotationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

rotationY

public ViewPropertyAnimatorCompat rotationY (float value)

This method will cause the View's rotationY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

rotationYBy

public ViewPropertyAnimatorCompat rotationYBy (float value)

This method will cause the View's rotationY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

scaleX

public ViewPropertyAnimatorCompat scaleX (float value)

This method will cause the View's scaleX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

scaleXBy

public ViewPropertyAnimatorCompat scaleXBy (float value)

This method will cause the View's scaleX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

scaleY

public ViewPropertyAnimatorCompat scaleY (float value)

This method will cause the View's scaleY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

scaleYBy

public ViewPropertyAnimatorCompat scaleYBy (float value)

This method will cause the View's scaleY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from the current value.

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

setDuration

public ViewPropertyAnimatorCompat setDuration (long value)

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.

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

setInterpolator

public ViewPropertyAnimatorCompat setInterpolator (Interpolator value)

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.

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

setListener

public ViewPropertyAnimatorCompat setListener (ViewPropertyAnimatorListener listener)

Sets a listener for events in the underlying Animators that run the property animations.

Parameters
listener ViewPropertyAnimatorListener: The listener to be called with AnimatorListener events. A value of null removes any existing listener.

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

setStartDelay

public ViewPropertyAnimatorCompat setStartDelay (long value)

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.

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

setUpdateListener

public ViewPropertyAnimatorCompat setUpdateListener (ViewPropertyAnimatorUpdateListener listener)

Sets a listener for update events in the underlying Animator that runs the property animations.

Prior to API 19, this method will do nothing.

Parameters
listener ViewPropertyAnimatorUpdateListener: The listener to be called with update events. A value of null removes any existing listener.

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

start

public void 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.

translationX

public ViewPropertyAnimatorCompat translationX (float value)

This method will cause the View's translationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value float: The value to be animated to.

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

translationXBy

public ViewPropertyAnimatorCompat translationXBy (float value)

This method will cause the View's translationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value float: The amount to be animated by, as an offset from