Animator

public abstract class Animator
extends Object implements Cloneable

java.lang.Object
   ↳ androidx.core.animation.Animator


This is the superclass for classes which provide basic support for animations which can be started, ended, and have AnimatorListeners added to them.

Summary

Nested classes

interface Animator.AnimatorListener

An animation listener receives notifications from an animation. 

interface Animator.AnimatorPauseListener

A pause listener receives notifications from an animation when the animation is paused or resumed

interface Animator.AnimatorUpdateListener

Implementors of this interface can add themselves as update listeners to an ValueAnimator instance to receive callbacks on every animation frame, after the current frame's values have been calculated for that ValueAnimator

Constants

long DURATION_INFINITE

The value used to indicate infinite duration (e.g.

Public constructors

Animator()

Public methods

void addListener(Animator.AnimatorListener listener)

Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.

void addPauseListener(Animator.AnimatorPauseListener listener)

Adds a pause listener to this animator.

void addUpdateListener(Animator.AnimatorUpdateListener listener)

Adds a listener to the set of listeners that are sent update events through the life of an animation.

void cancel()

Cancels the animation.

Animator clone()
void end()

Ends the animation.

abstract long getDuration()

Gets the duration of the animation.

Interpolator getInterpolator()

Returns the timing interpolator that this animation uses.

abstract long getStartDelay()

The amount of time, in milliseconds, to delay processing the animation after start() is called.

long getTotalDuration()

Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating.

boolean isPaused()

Returns whether this animator is currently in a paused state.

abstract boolean isRunning()

Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).

boolean isStarted()

Returns whether this Animator has been started and not yet ended.

void pause()

Pauses a running animation.

void removeAllListeners()

Removes all listeners and pauseListeners from this object.

void removeAllUpdateListeners()

Removes all listeners from the set listening to frame updates for this animation.

void removeListener(Animator.AnimatorListener listener)

Removes a listener from the set listening to this animation.

void removePauseListener(Animator.AnimatorPauseListener listener)

Removes a pause listener from the set listening to this animation.

void removeUpdateListener(Animator.AnimatorUpdateListener listener)

Removes a listener from the set listening to frame updates for this animation.

void resume()

Resumes a paused animation, causing the animator to pick up where it left off when it was paused.

abstract Animator setDuration(long duration)

Sets the duration of the animation.

abstract void setInterpolator(Interpolator value)

The interpolator used in calculating the elapsed fraction of the animation.

abstract void