# 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)

*** ** * ** ***

<br />

```
class AnimatedVectorDrawableCompat : Drawable, Animatable2Compat
```

<br />

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

### Inherited functions

From [android.graphics.drawable.Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#applyTheme(android.content.res.Resources.Theme)(t: https://developer.android.com/reference/android/content/res/Resources.Theme.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#clearColorFilter()()` `https://developer.android.com/reference/android/graphics/Rect.html!` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#copyBounds()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#copyBounds(android.graphics.Rect)(bounds: https://developer.android.com/reference/android/graphics/Rect.html!)` `java-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)(pathName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` `java-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)(

res: https://developer.android.com/reference/android/content/res/Resources.html!,

value: https://developer.android.com/reference/android/util/TypedValue.html!,

is: https://developer.android.com/reference/java/io/InputStream.html!,

srcName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!

)` `java-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)(is: https://developer.android.com/reference/java/io/InputStream.html!, srcName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` `java-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)(r: https://developer.android.com/reference/android/content/res/Resources.html!, parser: https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html!)` `java-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)(

r: https://developer.android.com/reference/android/content/res/Resources.html!,

parser: https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html!,

attrs: https://developer.android.com/reference/android/util/AttributeSet.html!

)` `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()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getHotspotBounds(android.graphics.Rect)(outRect: https://developer.android.com/reference/android/graphics/Rect.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getLayoutDirection()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getLevel()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getMinimumHeight()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `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()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getOutline(android.graphics.Outline)(outline: https://developer.android.com/reference/android/graphics/Outline.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getPadding(android.graphics.Rect)(padding: https://developer.android.com/reference/android/graphics/Rect.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` `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()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#hasFocusStateSpecified()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#invalidateSelf()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isFilterBitmap()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isProjected()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isVisible()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#jumpToCurrentState()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onBoundsChange(android.graphics.Rect)(bounds: https://developer.android.com/reference/android/graphics/Rect.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onLayoutDirectionChanged(int)(layoutDirection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#onLevelChange(int)(level: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#resolveOpacity(int, int)(op1: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, op2: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#scheduleSelf(java.lang.Runnable, long)(what: https://developer.android.com/reference/java/lang/Runnable.html!, when: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setBounds(android.graphics.Rect)(bounds: https://developer.android.com/reference/android/graphics/Rect.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setCallback(android.graphics.drawable.Drawable.Callback)(cb: https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setChangingConfigurations(int)(configs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setDither(boolean)(dither: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setFilterBitmap(boolean)(filter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setHotspot(float, float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setHotspotBounds(int, int, int, int)(left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setLayoutDirection(int)(layoutDirection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setLevel(int)(level: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setState(int[])(stateSet: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setTintBlendMode(android.graphics.BlendMode)(blendMode: https://developer.android.com/reference/android/graphics/BlendMode.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#unscheduleSelf(java.lang.Runnable)(what: https://developer.android.com/reference/java/lang/Runnable.html!)`

## Public functions

### applyTheme

```
fun applyTheme(t: Resources.Theme): Unit
```

### canApplyTheme

```
fun canApplyTheme(): Boolean
```

### clearAnimationCallbacks

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

```
fun clearAnimationCallbacks(): Unit
```

Removes all existing animation callbacks.

### clearAnimationCallbacks

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

```
java-static fun clearAnimationCallbacks(dr: Drawable?): Unit
```

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

```
fun clearColorFilter(): Unit
```

### create

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

```
java-static fun create(context: Context, resId: @DrawableRes Int): AnimatedVectorDrawableCompat?
```

Create a AnimatedVectorDrawableCompat object.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the context for creating the animators. |
| `resId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the resource ID for AnimatedVectorDrawableCompat object. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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)

```
java-static fun createFromXmlInner(
    context: Context,
    r: Resources,
    parser: XmlPullParser,
    attrs: AttributeSet,
    theme: Resources.Theme?
): AnimatedVectorDrawableCompat
```

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)

```
fun draw(canvas: Canvas): Unit
```

### getAlpha

```
fun getAlpha(): Int
```

### getChangingConfigurations

```
fun getChangingConfigurations(): Int
```

### getColorFilter

```
fun getColorFilter(): ColorFilter?
```

### getConstantState

```
fun getConstantState(): Drawable.ConstantState?
```

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

### getCurrent

```
fun getCurrent(): Drawable!
```

### getIntrinsicHeight

```
fun getIntrinsicHeight(): Int
```

### getIntrinsicWidth

```
fun getIntrinsicWidth(): Int
```

### getMinimumHeight

```
fun getMinimumHeight(): Int
```

### getMinimumWidth

```
fun getMinimumWidth(): Int
```

### getOpacity

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

```
fun getOpacity(): Int
```

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

### getPadding

```
fun getPadding(padding: Rect!): Boolean
```

### getState

```
fun getState(): Array<Int>!
```

### getTransparentRegion

```
fun getTransparentRegion(): Region!
```

### inflate

```
fun inflate(res: Resources, parser: XmlPullParser, attrs: AttributeSet): Unit
```

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

### inflate

```
fun inflate(
    res: Resources,
    parser: XmlPullParser,
    attrs: AttributeSet,
    theme: Resources.Theme?
): Unit
```

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

### isAutoMirrored

```
fun isAutoMirrored(): Boolean
```

### isRunning

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

```
fun isRunning(): Boolean
```

### isStateful

```
fun isStateful(): Boolean
```

### jumpToCurrentState

```
fun jumpToCurrentState(): Unit
```

### mutate

```
fun mutate(): Drawable
```

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)

```
fun registerAnimationCallback(
    callback: Animatable2Compat.AnimationCallback?
): Unit
```

Adds a callback to listen to the animation events.

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

### registerAnimationCallback

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

```
java-static fun registerAnimationCallback(
    dr: Drawable?,
    callback: Animatable2Compat.AnimationCallback?
): Unit
```

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)

```
fun setAlpha(alpha: Int): Unit
```

### setAutoMirrored

```
fun setAutoMirrored(mirrored: Boolean): Unit
```

### setChangingConfigurations

```
fun setChangingConfigurations(configs: Int): Unit
```

### setColorFilter

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

```
fun setColorFilter(colorFilter: ColorFilter?): Unit
```

### setColorFilter

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

```
fun setColorFilter(color: Int, mode: PorterDuff.Mode!): Unit
```

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

### setFilterBitmap

```
fun setFilterBitmap(filter: Boolean): Unit
```

### setHotspot

```
fun setHotspot(x: Float, y: Float): Unit
```

### setHotspotBounds

```
fun setHotspotBounds(left: Int, top: Int, right: Int, bottom: Int): Unit
```

### setState

```
fun setState(stateSet: IntArray<Int>!): Boolean
```

### setTint

```
fun setTint(tint: Int): Unit
```

### setTintList

```
fun setTintList(tint: ColorStateList?): Unit
```

### setTintMode

```
fun setTintMode(tintMode: PorterDuff.Mode?): Unit
```

### setVisible

```
fun setVisible(visible: Boolean, restart: Boolean): Boolean
```

### start

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

```
fun start(): Unit
```

### stop

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

```
fun stop(): Unit
```

### unregisterAnimationCallback

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

```
fun unregisterAnimationCallback(
    callback: Animatable2Compat.AnimationCallback?
): Boolean
```

Removes the specified animation callback.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `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)

```
java-static fun unregisterAnimationCallback(
    dr: Drawable?,
    callback: Animatable2Compat.AnimationCallback?
): Boolean
```

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 functions

### onBoundsChange

```
protected fun onBoundsChange(bounds: Rect!): Unit
```

### onLevelChange

```
protected fun onLevelChange(level: Int): Boolean
```

### onStateChange

```
protected fun onStateChange(state: IntArray<Int>!): Boolean
```