# DrawableWrapperCompat

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

*** ** * ** ***


```
public class DrawableWrapperCompat extends Drawable implements Drawable.Callback
```

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

*** ** * ** ***

Drawable which delegates all calls to its wrapped `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`.

The wrapped `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`*must* be fully released from any `https://developer.android.com/reference/android/view/View.html` before wrapping, otherwise internal `https://developer.android.com/reference/android/graphics/drawable/Drawable.Callback.html` may be dropped.

Adapted from platform class, altered with API level checks as necessary.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#DrawableWrapperCompat(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable)` Creates a new wrapper around the specified drawable. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#draw(android.graphics.Canvas)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Canvas.html canvas)` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getChangingConfigurations()()` |
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getCurrent()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getDrawable()()` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getIntrinsicHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getIntrinsicWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getMinimumHeight()()` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getMinimumWidth()()` |
| `int` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getOpacity()()` **This method is deprecated.** |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getPadding(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html padding)` |
| `int[]` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getState()()` |
| `https://developer.android.com/reference/android/graphics/Region.html` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#getTransparentRegion()()` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#invalidateDrawable(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable.html who)` |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#isAutoMirrored()()` |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#isStateful()()` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#jumpToCurrentState()()` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#scheduleDrawable(android.graphics.drawable.Drawable,java.lang.Runnable,long)(https://developer.android.com/reference/android/graphics/drawable/Drawable.html who, https://developer.android.com/reference/java/lang/Runnable.html what, long when)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setAlpha(int)(int alpha)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setAutoMirrored(boolean)(boolean mirrored)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setChangingConfigurations(int)(int configs)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setColorFilter(android.graphics.ColorFilter)(https://developer.android.com/reference/android/graphics/ColorFilter.html cf)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setDither(boolean)(boolean dither)` **This method is deprecated.** |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setDrawable(android.graphics.drawable.Drawable)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable)` Sets the wrapped drawable. |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setFilterBitmap(boolean)(boolean filter)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setHotspot(float,float)(float x, float y)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setHotspotBounds(int,int,int,int)(int left, int top, int right, int bottom)` |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setState(int[])(int[] stateSet)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setTint(int)(int tint)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setTintList(android.content.res.ColorStateList)(https://developer.android.com/reference/android/content/res/ColorStateList.html tint)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setTintMode(android.graphics.PorterDuff.Mode)(https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html tintMode)` |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#setVisible(boolean,boolean)(boolean visible, boolean restart)` |
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#unscheduleDrawable(android.graphics.drawable.Drawable,java.lang.Runnable)(https://developer.android.com/reference/android/graphics/drawable/Drawable.html who, https://developer.android.com/reference/java/lang/Runnable.html what)` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#onBoundsChange(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect.html bounds)` |
| `boolean` | `https://developer.android.com/reference/androidx/appcompat/graphics/drawable/DrawableWrapperCompat#onLevelChange(int)(int level)` |

| ### 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)` | | `boolean` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#canApplyTheme()()` | | `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 )` | | `int` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getAlpha()()` | | `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/ColorFilter.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getColorFilter()()` | | `https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getConstantState()()` | | `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()()` | | `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#hasFocusStateSpecified()()` | | `void` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#inflate(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)` | | `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()()` | | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#mutate()()` | | `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#onStateChange(int[])(int[] state)` | | `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)` | | `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)` | | `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 constructors

### DrawableWrapperCompat

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

```
public DrawableWrapperCompat(Drawable drawable)
```

Creates a new wrapper around the specified drawable.

## Public methods

### draw

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

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

### getChangingConfigurations

```
public int getChangingConfigurations()
```

### getCurrent

```
public Drawable getCurrent()
```

### getDrawable

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

```
public @Nullable Drawable getDrawable()
```

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | the wrapped drawable |

### getIntrinsicHeight

```
public int getIntrinsicHeight()
```

### getIntrinsicWidth

```
public int getIntrinsicWidth()
```

### getMinimumHeight

```
public int getMinimumHeight()
```

### getMinimumWidth

```
public int getMinimumWidth()
```

### getOpacity

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

```
public int getOpacity()
```

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

### getPadding

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

### getState

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

### getTransparentRegion

```
public Region getTransparentRegion()
```

### invalidateDrawable

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

```
public void invalidateDrawable(Drawable who)
```

### isAutoMirrored

```
public boolean isAutoMirrored()
```

### isStateful

```
public boolean isStateful()
```

### jumpToCurrentState

```
public void jumpToCurrentState()
```

### scheduleDrawable

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

```
public void scheduleDrawable(Drawable who, Runnable what, long when)
```

### setAlpha

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

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

### setAutoMirrored

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

### setChangingConfigurations

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

### setColorFilter

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

```
public void setColorFilter(ColorFilter cf)
```

### setDither

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

```
public void setDither(boolean dither)
```

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

### setDrawable

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

```
public void setDrawable(@Nullable Drawable drawable)
```

Sets the wrapped drawable.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable` | the wrapped drawable |

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

### setTintMode

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

### setVisible

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

### unscheduleDrawable

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

```
public void unscheduleDrawable(Drawable who, Runnable what)
```

## Protected methods

### onBoundsChange

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

### onLevelChange

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