Google 致力于为黑人社区推动种族平等。查看具体举措


class DrawableCompat

Helper for accessing features in


Public methods
static Unit
applyTheme(@NonNull drawable: Drawable, @NonNull theme: Theme)

Applies the specified theme to this Drawable and its children.

static Boolean
canApplyTheme(@NonNull drawable: Drawable)

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

static Unit
clearColorFilter(@NonNull drawable: Drawable)

Removes the color filter from the given drawable.

static Int
getAlpha(@NonNull drawable: Drawable)

Get the alpha value of the drawable.

static ColorFilter!
getColorFilter(@NonNull drawable: Drawable)

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

static Int
getLayoutDirection(@NonNull drawable: Drawable)

Returns the resolved layout direction for this Drawable.

static Unit
inflate(@NonNull drawable: Drawable, @NonNull res: Resources, @NonNull parser: XmlPullParser, @NonNull attrs: AttributeSet, @Nullable theme: Theme?)

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

static Boolean
isAutoMirrored(@NonNull drawable: Drawable)

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

static Unit
jumpToCurrentState(@NonNull drawable: Drawable)

Call Drawable.jumpToCurrentState().

static Unit
setAutoMirrored(@NonNull drawable: Drawable, mirrored: Boolean)

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

static Unit
setHotspot(@NonNull drawable: Drawable, x: Float, y: Float)

Specifies the hotspot's location within the drawable.

static Unit
setHotspotBounds(@NonNull drawable: Drawable, left: Int, top: Int, right: Int, bottom: Int)

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

static Boolean
setLayoutDirection(@NonNull drawable: Drawable, layoutDirection: Int)

Set the layout direction for this drawable.

static Unit
setTint(@NonNull drawable: Drawable, @ColorInt tint: Int)

Specifies a tint for drawable.

static Unit
setTintList(@NonNull drawable: Drawable, @Nullable tint: ColorStateList?)

Specifies a tint for drawable as a color state list.

static Unit
setTintMode(@NonNull drawable: Drawable, @NonNull tintMode: Mode)

Specifies a tint blending mode for drawable.

static T