added in version 22.1.0
belongs to Maven artifact


public final class DrawableCompat
extends Object


Helper for accessing features in Drawable.


Public methods

static void applyTheme(Drawable drawable, Resources.Theme theme)

Applies the specified theme to this Drawable and its children.

static boolean canApplyTheme(Drawable drawable)

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

static void clearColorFilter(Drawable drawable)

Removes the color filter from the given drawable.

static int getAlpha(Drawable drawable)

Get the alpha value of the drawable.

static ColorFilter getColorFilter(Drawable drawable)

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

static int getLayoutDirection(Drawable drawable)

Returns the resolved layout direction for this Drawable.

static void inflate(Drawable drawable, Resources res, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)

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

static boolean isAutoMirrored(Drawable drawable)

Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.

static void jumpToCurrentState(Drawable drawable)

This method was deprecated in API level 27.1.0. Use jumpToCurrentState() directly.

static void setAutoMirrored(Drawable drawable, boolean mirrored)

Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).

static void setHotspot(Drawable drawable, float x, float y)

Specifies the hotspot's location within the drawable.

static void setHotspotBounds(Drawable drawable, int left, int top, int right, int bottom)

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

static boolean setLayoutDirection(Drawable drawable, int layoutDirection)

Set the layout direction for this drawable.

static void setTint(Drawable drawable, int tint)

Specifies a tint for drawable.

static void setTintList(Drawable drawable, ColorStateList tint)

Specifies a tint for drawable as a color state list.