public class SeekableAnimatedVectorDrawable
extends Drawable implements Animatable


This class animates properties of a VectorDrawableCompat with animations defined using ObjectAnimator or AnimatorSet.

SeekableAnimatedVectorDrawable is defined in the same XML format as AnimatedVectorDrawable.

Here are all the animatable attributes in VectorDrawableCompat:

Element Name Animatable attribute name
<vector> alpha
<group> rotation
<path> fillColor

You can always create a SeekableAnimatedVectorDrawable object and use it as a Drawable by the Java API. In order to refer to SeekableAnimatedVectorDrawable inside an XML file, you can use app:srcCompat attribute in AppCompat library's ImageButton or ImageView.

SeekableAnimatedVectorDrawable supports the following features too:

  • Path Morphing (PathType evaluator). This is used for morphing one path into another.
  • Path Interpolation. This is used to defined a flexible interpolator (represented as a path) instead of the system defined ones like LinearInterpolator.
  • Animating 2 values in one ObjectAnimator according to one path's X value and Y value. One usage is moving one object in both X and Y dimensions along an path.

Unlike AnimatedVectorDrawableCompat, this class does not delegate to the platform AnimatedVectorDrawable on any API levels.


Nested classes

class SeekableAnimatedVectorDrawable.AnimationCallback

Abstract class for animation callback. 

Public methods

void applyTheme(Resources.Theme t)
boolean canApplyTheme()
void clearAnimationCallbacks()

Removes all existing animation callbacks.

static SeekableAnimatedVectorDrawable create(Context context, int resId)

Create a SeekableAnimatedVectorDrawable object.

static SeekableAnimatedVectorDrawable createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)

Create a SeekableAnimatedVectorDrawable from inside an XML document using an optional Resources.Theme.

void draw(Canvas canvas)
int getAlpha()
int getChangingConfigurations()
ColorFilter getColorFilter()
Drawable.ConstantState getConstantState()
long getCurrentPlayTime()

Returns the milliseconds elapsed since the start of the animation.

int getIntrinsicHeight()
int getIntrinsicWidth()
int getOpacity()

This method is deprecated. This method is no longer used in graphics optimizations

long getTotalDuration()

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

void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)
void inflate(Resources res, XmlPullParser parser, AttributeSet attrs)
boolean isAutoMirrored()
boolean isPaused()

Returns whether the animation is currently in a paused state.

boolean isRunning()

Returns whether the animation is running (has started and not yet ended).

boolean isStateful()
Drawable mutate()

mutate() is not supported.

void pause()

Pauses a running animation.

void registerAnimationCallback(SeekableAnimatedVectorDrawable.AnimationCallback callback)

Adds a callback to listen to the animation events.

void resume()

Resumes a paused animation.