# DrawableCompat

# DrawableCompat

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/graphics/drawable/DrawableCompat "View this page in Java")

<br />

```
class DrawableCompat
```

<br />

*** ** * ** ***

Helper for accessing features in[android.graphics.drawable.Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html).

## Summary

|                                           ### Public functions                                            |
|-----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [applyTheme](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#applyTheme(android.graphics.drawable.Drawable,android.content.res.Resources.Theme))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, theme: `[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme.html)`)` Applies the specified theme to this Drawable and its children.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)         | [canApplyTheme](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#canApplyTheme(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Whether a theme can be applied to this Drawable and its children.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [clearColorFilter](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#clearColorFilter(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Removes the color filter from the given drawable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                 | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "drawable.getAlpha()")` ~~[getAlpha](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#getAlpha(android.graphics.drawable.Drawable))~~`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` **This function is deprecated.** Call[getAlpha](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getAlpha())directly. <br />                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter.html)`?` | [getColorFilter](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#getColorFilter(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Returns the current color filter, or`null`if none set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                 | [getLayoutDirection](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#getLayoutDirection(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Returns the resolved layout direction for this Drawable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [inflate](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#inflate(android.graphics.drawable.Drawable,android.content.res.Resources,org.xmlpull.v1.XmlPullParser,android.util.AttributeSet,android.content.res.Resources.Theme))`(` ` drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`,` ` res: `[Resources](https://developer.android.com/reference/android/content/res/Resources.html)`,` ` parser: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`,` ` attrs: `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)`,` ` theme: `[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme.html)`?` `)` Inflate this Drawable from an XML resource optionally styled by a theme. |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)         | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "drawable.isAutoMirrored()")` ~~[isAutoMirrored](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#isAutoMirrored(android.graphics.drawable.Drawable))~~`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` **This function is deprecated.** Call[isAutoMirrored](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isAutoMirrored())directly. <br />                                                                                                                                                                                                                                                                                                     |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "drawable.jumpToCurrentState()")` ~~[jumpToCurrentState](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#jumpToCurrentState(android.graphics.drawable.Drawable))~~`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` **This function is deprecated.** Use[jumpToCurrentState](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#jumpToCurrentState())directly. <br />                                                                                                                                                                                                                                                                                  |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | `@`[ReplaceWith](https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith)`(expression = "drawable.setAutoMirrored(mirrored)")` ~~[setAutoMirrored](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setAutoMirrored(android.graphics.drawable.Drawable,boolean))~~`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, mirrored: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` **This function is deprecated.** Call setAutoMirrored directly. <br />                                                                                                                                                                                                                                                                                  |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [setHotspot](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setHotspot(android.graphics.drawable.Drawable,float,float))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, x: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, y: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Specifies the hotspot's location within the drawable.                                                                                                                                                                                                                                                                                                                                                                                        |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [setHotspotBounds](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setHotspotBounds(android.graphics.drawable.Drawable,int,int,int,int))`(` ` drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`,` ` left: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` top: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` right: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` bottom: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.                                                                                                                        |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)         | [setLayoutDirection](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setLayoutDirection(android.graphics.drawable.Drawable,int))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Set the layout direction for this drawable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [setTint](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTint(android.graphics.drawable.Drawable,int))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, tint: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Specifies a tint for`drawable`.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [setTintList](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTintList(android.graphics.drawable.Drawable,android.content.res.ColorStateList))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?)` Specifies a tint for`drawable`as a color state list.                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)               | [setTintMode](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTintMode(android.graphics.drawable.Drawable,android.graphics.PorterDuff.Mode))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`, tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?)` Specifies a tint blending mode for`drawable`.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `java-static T!`                                                                                          | `<T : `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`?> `[unwrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#unwrap(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Unwrap`drawable`if it is the result of a call to[wrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#wrap(android.graphics.drawable.Drawable)).                                                                                                                                                                                                                                                                                                                                       |
| `java-static `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | [wrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#wrap(android.graphics.drawable.Drawable))`(drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`)` Potentially wrap`drawable`so that it may be used for tinting across the different API levels, via the tinting methods in this class.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

## Public functions

### applyTheme

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

```
java-static fun applyTheme(drawable: Drawable, theme: Resources.Theme): Unit
```

Applies the specified theme to this Drawable and its children.  

### canApplyTheme

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

```
java-static fun canApplyTheme(drawable: Drawable): Boolean
```

Whether a theme can be applied to this Drawable and its children.  

### clearColorFilter

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

```
java-static fun clearColorFilter(drawable: Drawable): Unit
```

Removes the color filter from the given drawable.  

### getAlpha

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)  

```
@ReplaceWith(expression = "drawable.getAlpha()")
java-static fun [getAlpha](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#getAlpha(android.graphics.drawable.Drawable))(drawable: Drawable): Int
```
| **This function is deprecated.**   
|
| Call[getAlpha](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#getAlpha())directly.

Get the alpha value of the`drawable`. 0 means fully transparent, 255 means fully opaque.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method. |

### getColorFilter

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

```
java-static fun getColorFilter(drawable: Drawable): ColorFilter?
```

Returns the current color filter, or`null`if none set.  

|                                           Returns                                           |
|---------------------------------------------------------------------------------------------|-----------------------------------------------|
| [ColorFilter](https://developer.android.com/reference/android/graphics/ColorFilter.html)`?` | the current color filter, or`null`if none set |

### getLayoutDirection

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

```
java-static fun getLayoutDirection(drawable: Drawable): Int
```

Returns the resolved layout direction for this Drawable.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | One of[LAYOUT_DIRECTION_LTR](https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_LTR()),[LAYOUT_DIRECTION_RTL](https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_RTL()) |

|                                                                                    See also                                                                                    |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setLayoutDirection](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setLayoutDirection(android.graphics.drawable.Drawable,int)) |   |

### inflate

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

```
java-static fun inflate(
    drawable: Drawable,
    res: Resources,
    parser: XmlPullParser,
    attrs: AttributeSet,
    theme: Resources.Theme?
): Unit
```

Inflate this Drawable from an XML resource optionally styled by a theme.  

|                                                   Parameters                                                    |
|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)         | drawable to inflate.                           |
| `res: `[Resources](https://developer.android.com/reference/android/content/res/Resources.html)                  | Resources used to resolve attribute values     |
| `parser: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)            | XML parser from which to inflate this Drawable |
| `attrs: `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)                 | Base set of attribute values                   |
| `theme: `[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme.html)`?` | Theme to apply, may be null                    |

|                                                           Throws                                                            |
|-----------------------------------------------------------------------------------------------------------------------------|---|
| [org.xmlpull.v1.XmlPullParserException](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html) |   |
| [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html)                                     |   |

### isAutoMirrored

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)  

```
@ReplaceWith(expression = "drawable.isAutoMirrored()")
java-static fun [isAutoMirrored](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#isAutoMirrored(android.graphics.drawable.Drawable))(drawable: Drawable): Boolean
```
| **This function is deprecated.**   
|
| Call[isAutoMirrored](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#isAutoMirrored())directly.

Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left. See[android.util.LayoutDirection](https://developer.android.com/reference/android/util/LayoutDirection.html).

If running on a pre-[KITKAT](https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#KITKAT())device this method returns false.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | boolean Returns true if this Drawable will be automatically mirrored. |

### jumpToCurrentState

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
@ReplaceWith(expression = "drawable.jumpToCurrentState()")
java-static fun [jumpToCurrentState](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#jumpToCurrentState(android.graphics.drawable.Drawable))(drawable: Drawable): Unit
```
| **This function is deprecated.**   
|
| Use[jumpToCurrentState](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#jumpToCurrentState())directly.

Call[Drawable.jumpToCurrentState()](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#jumpToCurrentState()).  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method. |

### setAutoMirrored

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  
Deprecated in[1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)  

```
@ReplaceWith(expression = "drawable.setAutoMirrored(mirrored)")
java-static fun [setAutoMirrored](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setAutoMirrored(android.graphics.drawable.Drawable,boolean))(drawable: Drawable, mirrored: Boolean): Unit
```
| **This function is deprecated.**   
|
| Call setAutoMirrored directly.

Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left). See[android.util.LayoutDirection](https://developer.android.com/reference/android/util/LayoutDirection.html).

If running on a pre-[KITKAT](https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#KITKAT())device this method does nothing.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method.              |
| `mirrored: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)         | Set to true if the Drawable should be mirrored, false if not. |

### setHotspot

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

```
java-static fun setHotspot(drawable: Drawable, x: Float, y: Float): Unit
```

Specifies the hotspot's location within the drawable.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method. |
| `x: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)                    | The X coordinate of the center of the hotspot    |
| `y: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)                    | The Y coordinate of the center of the hotspot    |

### setHotspotBounds

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

```
java-static fun setHotspotBounds(
    drawable: Drawable,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Unit
```

Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable against which to invoke the method. |
| `left: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                     | position in pixels of the left bound             |
| `top: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                      | position in pixels of the top bound              |
| `right: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                    | position in pixels of the right bound            |
| `bottom: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                   | position in pixels of the bottom bound           |

### setLayoutDirection

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

```
java-static fun setLayoutDirection(drawable: Drawable, layoutDirection: Int): Boolean
```

Set the layout direction for this drawable. Should be a resolved layout direction, as the Drawable has no capacity to do the resolution on its own.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | drawable for which to set the layout direction.                                                                                                                                                                                                                                                                |
| `layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | the resolved layout direction for the drawable, either[LAYOUT_DIRECTION_LTR](https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_LTR())or[LAYOUT_DIRECTION_RTL](https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat#LAYOUT_DIRECTION_RTL()) |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if the layout direction change has caused the appearance of the drawable to change such that it needs to be re-drawn,`false`otherwise |

|                                                                                  See also                                                                                  |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getLayoutDirection](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#getLayoutDirection(android.graphics.drawable.Drawable)) |   |

### setTint

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

```
java-static fun setTint(drawable: Drawable, tint: @ColorInt Int): Unit
```

Specifies a tint for`drawable`.  

|                                                                                   Parameters                                                                                   |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)                                                                        | The Drawable against which to invoke the method. |
| `tint: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Color to use for tinting this drawable           |

### setTintList

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

```
java-static fun setTintList(drawable: Drawable, tint: ColorStateList?): Unit
```

Specifies a tint for`drawable`as a color state list.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)      | The Drawable against which to invoke the method.                             |
| `tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | Color state list to use for tinting this drawable, or null to clear the tint |

### setTintMode

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

```
java-static fun setTintMode(drawable: Drawable, tintMode: PorterDuff.Mode?): Unit
```

Specifies a tint blending mode for`drawable`.  

|                                                   Parameters                                                    |
|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)         | The Drawable against which to invoke the method. |
| `tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?` | A Porter-Duff blending mode                      |

### unwrap

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

```
java-static fun <T : Drawable?> unwrap(drawable: Drawable): T!
```

Unwrap`drawable`if it is the result of a call to[wrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#wrap(android.graphics.drawable.Drawable)). If the`drawable`is not the result of a call to[wrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#wrap(android.graphics.drawable.Drawable))then`drawable`is returned as-is.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The drawable to unwrap |

| Returns |
|---------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `T!`    | the unwrapped[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)or`drawable`if it hasn't been wrapped. |

|                                                                    See also                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [wrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#wrap(android.graphics.drawable.Drawable)) |   |

### wrap

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

```
java-static fun wrap(drawable: Drawable): Drawable
```

Potentially wrap`drawable`so that it may be used for tinting across the different API levels, via the tinting methods in this class.

If the given drawable is wrapped, we will copy over certain state over to the wrapped drawable, such as its bounds, level, visibility and state.

You must use the result of this call. If the given drawable is being used by a view (as its background for instance), you must replace the original drawable with the result of this call:  

```kotlin
Drawable bg = DrawableCompat.wrap(view.getBackground());
// Need to set the background with the wrapped drawable
view.setBackground(bg);

// You can now tint the drawable
DrawableCompat.setTint(bg, ...);
```

If you need to get hold of the original[android.graphics.drawable.Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)again, you can use the value returned from[unwrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#unwrap(android.graphics.drawable.Drawable)).  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|-------------------------|
| `drawable: `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | The Drawable to process |

|                                           Returns                                           |
|---------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | A drawable capable of being tinted across all API levels. |

|                                                                                            See also                                                                                             |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setTint](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTint(android.graphics.drawable.Drawable,int))                                        |   |
| [setTintList](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTintList(android.graphics.drawable.Drawable,android.content.res.ColorStateList)) |   |
| [setTintMode](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTintMode(android.graphics.drawable.Drawable,android.graphics.PorterDuff.Mode))   |   |
| [unwrap](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#unwrap(android.graphics.drawable.Drawable))                                              |   |