DrawableCompat

Helper for accessing features in android.graphics.drawable.Drawable.

Functions

Link copied to clipboard
open fun applyTheme(@NonNull drawable: Drawable, @NonNull theme: Resources.Theme)
Applies the specified theme to this Drawable and its children.
Link copied to clipboard
open fun canApplyTheme(@NonNull drawable: Drawable): Boolean
Whether a theme can be applied to this Drawable and its children.
Link copied to clipboard
open fun clearColorFilter(@NonNull drawable: Drawable)
Removes the color filter from the given drawable.
Link copied to clipboard
open fun getAlpha(@NonNull drawable: Drawable): Int
Get the alpha value of the drawable.
Link copied to clipboard
Returns the current color filter, or null if none set.
Link copied to clipboard
open fun getLayoutDirection(@NonNull drawable: Drawable): Int
Returns the resolved layout direction for this Drawable.
Link copied to clipboard
open fun inflate(@NonNull drawable: Drawable, @NonNull res: Resources, @NonNull parser: XmlPullParser, @NonNull attrs: AttributeSet, @Nullable theme: Resources.Theme)
Inflate this Drawable from an XML resource optionally styled by a theme.
Link copied to clipboard
open fun isAutoMirrored(@NonNull drawable: Drawable): Boolean
Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.
Link copied to clipboard
Link copied to clipboard
open fun setAutoMirrored(@NonNull drawable: Drawable, mirrored: Boolean)
Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).
Link copied to clipboard
open fun setHotspot(@NonNull drawable: Drawable, x: Float, y: Float)
Specifies the hotspot's location within the drawable.
Link copied to clipboard
open fun 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.
Link copied to clipboard
open fun setLayoutDirection(@NonNull drawable: Drawable, layoutDirection: Int): Boolean
Set the layout direction for this drawable.
Link copied to clipboard
open fun setTint(@NonNull drawable: Drawable, @ColorInt tint: Int)
Specifies a tint for drawable.
Link copied to clipboard
open fun setTintList(@NonNull drawable: Drawable, @Nullable tint: ColorStateList)
Specifies a tint for drawable as a color state list.
Link copied to clipboard
open fun setTintMode(@NonNull drawable: Drawable, @Nullable tintMode: PorterDuff.Mode)
Specifies a tint blending mode for drawable.
Link copied to clipboard
open fun <T : Drawable?> unwrap(@NonNull drawable: Drawable): T
Unwrap drawable if it is the result of a call to wrap.
Link copied to clipboard
open fun wrap(@NonNull 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.