# VectorDrawableCompat

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

*** ** * ** ***


```
public class VectorDrawableCompat extends Drawable
```

<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.VectorDrawableCompat](https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat) |

*** ** * ** ***

For API 24 and above, this class delegates to the framework's `https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html`. For older API version, this class lets you create a drawable based on an XML vector graphic.
You can always create a VectorDrawableCompat object and use it as a Drawable by the Java API. In order to refer to VectorDrawableCompat inside a XML file, you can use app:srcCompat attribute in AppCompat library's ImageButton or ImageView. **Note:** To optimize for the re-drawing performance, one bitmap cache is created for each VectorDrawableCompat. Therefore, referring to the same VectorDrawableCompat means sharing the same bitmap cache. If these references don't agree upon on the same size, the bitmap will be recreated and redrawn every time size is changed. In other words, if a VectorDrawable is used for different sizes, it is more efficient to create multiple VectorDrawables, one for each size. VectorDrawableCompat can be defined in an XML file with the `<vector>` element. The VectorDrawableCompat has the following elements:

`<vector>`

:   Used to define a vector drawable

    `android:name`

    :   Defines the name of this vector drawable.

    `android:width`

    :   Used to define the intrinsic width of the drawable. This support all the dimension units, normally specified with dp.

    `android:height`

    :   Used to define the intrinsic height the drawable. This support all the dimension units, normally specified with dp.

    `android:viewportWidth`

    :   Used to define the width of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

    `android:viewportHeight`

    :   Used to define the height of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.

    `android:tint`

    :   The color to apply to the drawable as a tint. By default, no tint is applied.

    `android:tintMode`

    :   The Porter-Duff blending mode for the tint color. Default is src_in.

    `android:autoMirrored`

    :   Indicates if the drawable needs to be mirrored when its layout direction is RTL (right-to-left). Default is false.

    `android:alpha`

    :   The opacity of this drawable. Default is 1.

`<group>`

:   Defines a group of paths or subgroups, plus transformation information. The transformations are defined in the same coordinates as the viewport. And the transformations are applied in the order of scale, rotate then translate.

    `android:name`

    :   Defines the name of the group.

    `android:rotation`

    :   The degrees of rotation of the group. Default is 0.

    `android:pivotX`

    :   The X coordinate of the pivot for the scale and rotation of the group. This is defined in the viewport space. Default is 0.

    `android:pivotY`

    :   The Y coordinate of the pivot for the scale and rotation of the group. This is defined in the viewport space. Default is 0.

    `android:scaleX`

    :   The amount of scale on the X Coordinate. Default is 1.

    `android:scaleY`

    :   The amount of scale on the Y coordinate. Default is 1.

    `android:translateX`

    :   The amount of translation on the X coordinate. This is defined in the viewport space. Default is 0.

    `android:translateY`

    :   The amount of translation on the Y coordinate. This is defined in the viewport space. Default is 0.

`<path>`

:   Defines paths to be drawn.

    `android:name`

    :   Defines the name of the path.

    `android:pathData`

    :   Defines path data using exactly same format as "d" attribute in the SVG's path data. This is defined in the viewport space.

    `android:fillColor`

    :   Specifies the color used to fill the path. If this property is animated, any value set by the animation will override the original value. No path fill is drawn if this property is not specified.

    `android:strokeColor`

    :   Specifies the color used to draw the path outline. If this property is animated, any value set by the animation will override the original value. No path outline is drawn if this property is not specified.

    `android:strokeWidth`

    :   The width a path stroke. Default is 0.

    `android:strokeAlpha`

    :   The opacity of a path stroke. Default is 1.

    `android:fillAlpha`

    :   The opacity to fill the path with. Default is 1.

    `android:trimPathStart`

    :   The fraction of the path to trim from the start, in the range from 0 to 1. Default is 0.

    `android:trimPathEnd`

    :   The fraction of the path to trim from the end, in the range from 0 to 1. Default is 1.

    `android:trimPathOffset`

    :   Shift trim region (allows showed region to include the start and end), in the range from 0 to 1. Default is 0.

    `android:strokeLineCap`

    :   Sets the linecap for a stroked path: butt, round, square. Default is butt.

    `android:strokeLineJoin`

    :   Sets the lineJoin for a stroked path: miter,round,bevel. Default is miter.

    `android:strokeMiterLimit`

    :   Sets the Miter limit for a stroked path. Default is 4.

    `android:fillType`

    :   Sets the fillType for a path. The types can be either "evenOdd" or "nonZero". They behave the same as SVG's "fill-rule" properties. Default is nonZero. For more details, see [FillRuleProperty](https://www.w3.org/TR/SVG/painting.html#FillRuleProperty)

`<clip-path>`

:   Defines path to be the current clip. Note that the clip path only apply to the current group and its children.

    `android:name`

    :   Defines the name of the clip path.

    `android:pathData`

    :   Defines clip path using the same format as "d" attribute in the SVG's path data.

#### Gradient support

We support 3 types of gradients: `https://developer.android.com/reference/android/graphics/LinearGradient.html`, `https://developer.android.com/reference/android/graphics/RadialGradient.html`, or `https://developer.android.com/reference/android/graphics/SweepGradient.html`. And we support all of 3 types of tile modes `https://developer.android.com/reference/android/graphics/Shader.TileMode.html`: CLAMP, REPEAT, MIRROR. Note that different attributes are relevant for different types of gradient.

| LinearGradient | RadialGradient | SweepGradient |
|---|---|---|
| startColor | startColor | startColor |
| centerColor | centerColor | centerColor |
| endColor | endColor | endColor |
| type | type | type |
| tileMode | tileMode | tileMode |
| startX | centerX | centerX |
| startY | centerY | centerY |
| endX | gradientRadius |   |
| endY |   |   |

Also note that if any color item is defined, then startColor, centerColor and endColor will be ignored. Note that theme attributes in XML file are supported through `` `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#inflate(android.content.res.Resources,org.xmlpull.v1.XmlPullParser,android.util.AttributeSet,android.content.res.Resources.Theme)` ``.

## Summary

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#canApplyTheme()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#clearColorFilter()()` |
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#create(android.content.res.Resources,int,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/DrawableRes int resId, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/Resources.Theme.html theme )` Create a VectorDrawableCompat object. |
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#createFromXmlInner(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 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 VectorDrawableCompat 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/VectorDrawableCompat#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/VectorDrawableCompat#getAlpha()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#getColorFilter()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getConstantState()()` |
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getCurrent()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getIntrinsicHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getIntrinsicWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getMinimumHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getMinimumWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getOpacity()()` **This method is deprecated.** |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getPadding(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html padding)` |
| `int[]` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getState()()` |
| `https://developer.android.com/reference/android/graphics/Region.html` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#getTransparentRegion()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#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 )` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#invalidateSelf()()` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#isAutoMirrored()()` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#isStateful()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#mutate()()` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#scheduleSelf(java.lang.Runnable,long)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html what, long when)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setAlpha(int)(int alpha)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setAutoMirrored(boolean)(boolean mirrored)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setChangingConfigurations(int)(int configs)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#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/VectorDrawableCompat#setFilterBitmap(boolean)(boolean filter)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setHotspot(float,float)(float x, float y)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setHotspotBounds(int,int,int,int)(int left, int top, int right, int bottom)` |
| `boolean` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setState(int[])(int[] stateSet)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#setTint(int)(int tint)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#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/VectorDrawableCompat#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/VectorDrawableCompat#setVisible(boolean,boolean)(boolean visible, boolean restart)` |
| `void` | `https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat#unscheduleSelf(java.lang.Runnable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html what)` |

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

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

## Public methods

### applyTheme

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

### canApplyTheme

```
public boolean canApplyTheme()
```

### clearColorFilter

```
public void clearColorFilter()
```

### create

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

```
public static @Nullable VectorDrawableCompat create(
    @NonNull Resources res,
    @DrawableRes int resId,
    @Nullable Resources.Theme theme
)
```

Create a VectorDrawableCompat object.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/res/Resources.html res` | the resources. |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int resId` | the resource ID for VectorDrawableCompat object. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/Resources.Theme.html theme` | the theme of this vector drawable, it can be null. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/vectordrawable/graphics/drawable/VectorDrawableCompat` | a new VectorDrawableCompat 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 VectorDrawableCompat createFromXmlInner(
    @NonNull Resources r,
    @NonNull XmlPullParser parser,
    @NonNull AttributeSet attrs,
    @Nullable Resources.Theme theme
)
```

Create a VectorDrawableCompat 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 @NonNull Drawable.ConstantState getConstantState()
```

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

### invalidateSelf

```
public void invalidateSelf()
```

### isAutoMirrored

```
public boolean isAutoMirrored()
```

### isStateful

```
public boolean isStateful()
```

### jumpToCurrentState

```
public void jumpToCurrentState()
```

### mutate

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

### scheduleSelf

```
public void scheduleSelf(@NonNull Runnable what, long when)
```

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

### unscheduleSelf

```
public void unscheduleSelf(@NonNull Runnable what)
```

## Protected methods

### onBoundsChange

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

### onLevelChange

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

### onStateChange

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