# AnimatedVectorDrawableCompat

Artifact: [androidx.vectordrawable:vectordrawable-animated](https://developer.android.com/jetpack/androidx/releases/vectordrawable) [View Source](https://cs.android.com/search?q=file:androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat.java+class:androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

*** ** * ** ***


```
public class AnimatedVectorDrawableCompat extends Drawable implements Animatable2Compat
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.graphics.drawable.Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) ||
|   | ↳ | [androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat](https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat) |

*** ** * ** ***

For API 24 and above, this class is delegating to the framework's `https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html`. For older API version, this class uses `https://developer.android.com/reference/android/animation/ObjectAnimator.html` and `https://developer.android.com/reference/android/animation/AnimatorSet.html` to animate the properties of a `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat` to create an animated drawable.
AnimatedVectorDrawableCompat are defined in the same XML format as `https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html`. Here are all the animatable attributes in `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat`:

| Element Name | Animatable attribute name |
|---|---|
|   | alpha |
|   | rotation |
| pivotX |
| pivotY |
| scaleX |
| scaleY |
| translateX |
| translateY |
|   | fillColor |
| pathData |
| strokeColor |
| strokeWidth |
| strokeAlpha |
| fillAlpha |
| trimPathStart |
| trimPathEnd |
| trimPathOffset |

You can always create a AnimatedVectorDrawableCompat object and use it as a Drawable by the Java API. In order to refer to AnimatedVectorDrawableCompat inside a XML file, you can use app:srcCompat attribute in AppCompat library's ImageButton or ImageView. Note that the animation in AnimatedVectorDrawableCompat now can support the following features:

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

## Summary

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#applyTheme(android.content.res.Resources.Theme)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.Theme.html t)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#canApplyTheme()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#clearAnimationCallbacks()()` Removes all existing animation callbacks. |
| `static void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#clearAnimationCallbacks(android.graphics.drawable.Drawable)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/drawable/Drawable.html dr)` Utility function to clear animation callbacks from Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#clearColorFilter()()` |
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#create(android.content.Context,int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/DrawableRes int resId)` Create a AnimatedVectorDrawableCompat object. |
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#createFromXmlInner(android.content.Context,android.content.res.Resources,org.xmlpull.v1.XmlPullParser,android.util.AttributeSet,android.content.res.Resources.Theme)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.html r, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html parser, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/Resources.Theme.html theme )` Create a AnimatedVectorDrawableCompat from inside an XML document using an optional `https://developer.android.com/reference/android/content/res/Resources.Theme.html`. |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#draw(android.graphics.Canvas)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas)` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getAlpha()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getChangingConfigurations()()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/ColorFilter.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getColorFilter()()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getConstantState()()` **Note** that we don't support constant state when SDK \<24. |
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getCurrent()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getIntrinsicHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getIntrinsicWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getMinimumHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getMinimumWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getOpacity()()` **This method is deprecated.** |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getPadding(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html padding)` |
| `int[]` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getState()()` |
| `https://developer.android.com/reference/android/graphics/Region.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#getTransparentRegion()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#inflate(android.content.res.Resources,org.xmlpull.v1.XmlPullParser,android.util.AttributeSet)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.html res, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html parser, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs )` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#inflate(android.content.res.Resources,org.xmlpull.v1.XmlPullParser,android.util.AttributeSet,android.content.res.Resources.Theme)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.html res, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html parser, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/Resources.Theme.html theme )` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#isAutoMirrored()()` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#isRunning()()` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#isStateful()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#jumpToCurrentState()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#mutate()()` mutate() will be effective only if the getConstantState() is returning non-null. |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#registerAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback )` Adds a callback to listen to the animation events. |
| `static void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#registerAnimationCallback(android.graphics.drawable.Drawable,androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/drawable/Drawable.html dr, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback )` Utility function to register callback to Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setAlpha(int)(int alpha)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setAutoMirrored(boolean)(boolean mirrored)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setChangingConfigurations(int)(int configs)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setColorFilter(android.graphics.ColorFilter)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/ColorFilter.html colorFilter)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setColorFilter(int,android.graphics.PorterDuff.Mode)(int color, https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html mode)` **This method is deprecated.** |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setFilterBitmap(boolean)(boolean filter)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setHotspot(float,float)(float x, float y)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setHotspotBounds(int,int,int,int)(int left, int top, int right, int bottom)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setState(int[])(int[] stateSet)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setTint(int)(int tint)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setTintList(android.content.res.ColorStateList)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/ColorStateList.html tint)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setTintMode(android.graphics.PorterDuff.Mode)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html tintMode)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#setVisible(boolean,boolean)(boolean visible, boolean restart)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#start()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#stop()()` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#unregisterAnimationCallback(androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback )` Removes the specified animation callback. |
| `static boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#unregisterAnimationCallback(android.graphics.drawable.Drawable,androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/drawable/Drawable.html dr, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback )` Utility function to unregister animation callback from Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#onBoundsChange(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html bounds)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#onLevelChange(int)(int level)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat#onStateChange(int[])(int[] state)` |

| ### Inherited methods |
|---|
| From [android.graphics.drawable.Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) |---|---| | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#applyTheme(android.content.res.Resources.Theme)(https://developer.android.com/reference/android/content/res/Resources.Theme.html t)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#clearColorFilter()()` | | `final https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#copyBounds()()` | | `final void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#copyBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html bounds)` | | `static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#createFromPath(java.lang.String)(https://developer.android.com/reference/java/lang/String.html pathName)` | | `static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String)( https://developer.android.com/reference/android/content/res/Resources.html res, https://developer.android.com/reference/android/util/TypedValue.html value, https://developer.android.com/reference/java/io/InputStream.html is, https://developer.android.com/reference/java/lang/String.html srcName )` | | `static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#createFromStream(java.io.InputStream, java.lang.String)(https://developer.android.com/reference/java/io/InputStream.html is, https://developer.android.com/reference/java/lang/String.html srcName)` | | `static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser)(https://developer.android.com/reference/android/content/res/Resources.html r, https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html parser)` | | `static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#createFromXmlInner(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet)( https://developer.android.com/reference/android/content/res/Resources.html r, https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html parser, https://developer.android.com/reference/android/util/AttributeSet.html attrs )` | | `final https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getBounds()()` | | `https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getCallback()()` | | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getCurrent()()` | | `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getDirtyBounds()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getHotspotBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html outRect)` | | `int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getLayoutDirection()()` | | `final int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getLevel()()` | | `int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getMinimumHeight()()` | | `int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getMinimumWidth()()` | | `https://developer.android.com/reference/android/graphics/Insets.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getOpticalInsets()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getOutline(android.graphics.Outline)(https://developer.android.com/reference/android/graphics/Outline.html outline)` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getPadding(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html padding)` | | `int[]` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getState()()` | | `https://developer.android.com/reference/android/graphics/Region.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getTransparentRegion()()` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#hasFocusStateSpecified()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#invalidateSelf()()` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isFilterBitmap()()` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isProjected()()` | | `final boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isVisible()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#jumpToCurrentState()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onBoundsChange(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html bounds)` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onLayoutDirectionChanged(int)(int layoutDirection)` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onLevelChange(int)(int level)` | | `static int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#resolveOpacity(int, int)(int op1, int op2)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#scheduleSelf(java.lang.Runnable, long)(https://developer.android.com/reference/java/lang/Runnable.html what, long when)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html bounds)` | | `final void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setCallback(android.graphics.drawable.Drawable.Callback)(https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html cb)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setChangingConfigurations(int)(int configs)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setDither(boolean)(boolean dither)` **This method is deprecated.** | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setFilterBitmap(boolean)(boolean filter)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setHotspot(float, float)(float x, float y)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setHotspotBounds(int, int, int, int)(int left, int top, int right, int bottom)` | | `final boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setLayoutDirection(int)(int layoutDirection)` | | `final boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setLevel(int)(int level)` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setState(int[])(int[] stateSet)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setTintBlendMode(android.graphics.BlendMode)(https://developer.android.com/reference/android/graphics/BlendMode.html blendMode)` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#unscheduleSelf(java.lang.Runnable)(https://developer.android.com/reference/java/lang/Runnable.html what)` | |

## Public methods

### applyTheme

```
public void applyTheme(@NonNull Resources.Theme t)
```

### canApplyTheme

```
public boolean canApplyTheme()
```

### clearAnimationCallbacks

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.2.0)

```
public void clearAnimationCallbacks()
```

Removes all existing animation callbacks.

### clearAnimationCallbacks

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public static void clearAnimationCallbacks(@Nullable Drawable dr)
```

Utility function to clear animation callbacks from Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). From API 24 on, the drawable is treated as an AnimatedVectorDrawable. Otherwise, it is treated as AnimatedVectorDrawableCompat.

### clearColorFilter

```
public void clearColorFilter()
```

### create

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public static @Nullable AnimatedVectorDrawableCompat create(@NonNull Context context, @DrawableRes int resId)
```

Create a AnimatedVectorDrawableCompat object.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | the context for creating the animators. |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int resId` | the resource ID for AnimatedVectorDrawableCompat object. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/AnimatedVectorDrawableCompat` | a new AnimatedVectorDrawableCompat or null if parsing error is found. |

### createFromXmlInner

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public static @NonNull AnimatedVectorDrawableCompat createFromXmlInner(
    @NonNull Context context,
    @NonNull Resources r,
    @NonNull XmlPullParser parser,
    @NonNull AttributeSet attrs,
    @Nullable Resources.Theme theme
)
```

Create a AnimatedVectorDrawableCompat from inside an XML document using an optional `https://developer.android.com/reference/android/content/res/Resources.Theme.html`. Called on a parser positioned at a tag in an XML document, tries to create a Drawable from that tag. Returns `null` if the tag is not a valid drawable.

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` |   |
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### draw

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void draw(@NonNull Canvas canvas)
```

### getAlpha

```
public int getAlpha()
```

### getChangingConfigurations

```
public int getChangingConfigurations()
```

### getColorFilter

```
public @Nullable ColorFilter getColorFilter()
```

### getConstantState

```
public @Nullable Drawable.ConstantState getConstantState()
```

**Note** that we don't support constant state when SDK \<24. Make sure you check the return value before using it.

### getCurrent

```
public Drawable getCurrent()
```

### getIntrinsicHeight

```
public int getIntrinsicHeight()
```

### getIntrinsicWidth

```
public int getIntrinsicWidth()
```

### getMinimumHeight

```
public int getMinimumHeight()
```

### getMinimumWidth

```
public int getMinimumWidth()
```

### getOpacity

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public int getOpacity()
```

> [!CAUTION]
> **This method is deprecated.**   

### getPadding

```
public boolean getPadding(Rect padding)
```

### getState

```
public int[] getState()
```

### getTransparentRegion

```
public Region getTransparentRegion()
```

### inflate

```
public void inflate(
    @NonNull Resources res,
    @NonNull XmlPullParser parser,
    @NonNull AttributeSet attrs
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` |   |
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### inflate

```
public void inflate(
    @NonNull Resources res,
    @NonNull XmlPullParser parser,
    @NonNull AttributeSet attrs,
    @Nullable Resources.Theme theme
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` |   |
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### isAutoMirrored

```
public boolean isAutoMirrored()
```

### isRunning

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public boolean isRunning()
```

### isStateful

```
public boolean isStateful()
```

### jumpToCurrentState

```
public void jumpToCurrentState()
```

### mutate

```
public @NonNull Drawable mutate()
```

mutate() will be effective only if the getConstantState() is returning non-null. Otherwise, it just return the current object without modification.

### registerAnimationCallback

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.2.0)

```
public void registerAnimationCallback(
    @Nullable Animatable2Compat.AnimationCallback callback
)
```

Adds a callback to listen to the animation events.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback` | Callback to add. |

### registerAnimationCallback

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public static void registerAnimationCallback(
    @Nullable Drawable dr,
    @Nullable Animatable2Compat.AnimationCallback callback
)
```

Utility function to register callback to Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). From API 24 on, the drawable is treated as an AnimatedVectorDrawable. Otherwise, it is treated as AnimatedVectorDrawableCompat.

### setAlpha

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void setAlpha(int alpha)
```

### setAutoMirrored

```
public void setAutoMirrored(boolean mirrored)
```

### setChangingConfigurations

```
public void setChangingConfigurations(int configs)
```

### setColorFilter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void setColorFilter(@Nullable ColorFilter colorFilter)
```

### setColorFilter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void setColorFilter(int color, PorterDuff.Mode mode)
```

> [!CAUTION]
> **This method is deprecated.**   

### setFilterBitmap

```
public void setFilterBitmap(boolean filter)
```

### setHotspot

```
public void setHotspot(float x, float y)
```

### setHotspotBounds

```
public void setHotspotBounds(int left, int top, int right, int bottom)
```

### setState

```
public boolean setState(int[] stateSet)
```

### setTint

```
public void setTint(int tint)
```

### setTintList

```
public void setTintList(@Nullable ColorStateList tint)
```

### setTintMode

```
public void setTintMode(@Nullable PorterDuff.Mode tintMode)
```

### setVisible

```
public boolean setVisible(boolean visible, boolean restart)
```

### start

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void start()
```

### stop

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public void stop()
```

### unregisterAnimationCallback

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.2.0)

```
public boolean unregisterAnimationCallback(
    @Nullable Animatable2Compat.AnimationCallback callback
)
```

Removes the specified animation callback.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/Animatable2Compat.AnimationCallback callback` | Callback to remove. |

| Returns |
|---|---|
| `boolean` | `false` if callback didn't exist in the call back list, or `true` if callback has been removed successfully. |

### unregisterAnimationCallback

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/vectordrawable#1.0.0)

```
public static boolean unregisterAnimationCallback(
    @Nullable Drawable dr,
    @Nullable Animatable2Compat.AnimationCallback callback
)
```

Utility function to unregister animation callback from Drawable, when the drawable is created from XML and referred in Java code, e.g: ImageView.getDrawable(). From API 24 on, the drawable is treated as an AnimatedVectorDrawable. Otherwise, it is treated as AnimatedVectorDrawableCompat.

## Protected methods

### onBoundsChange

```
protected void onBoundsChange(Rect bounds)
```

### onLevelChange

```
protected boolean onLevelChange(int level)
```

### onStateChange

```
protected boolean onStateChange(int[] state)
```