DrawableContainerCompat


public class DrawableContainerCompat extends Drawable implements Drawable.Callback

Known direct subclasses
StateListDrawableCompat

Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.

Known indirect subclasses
AnimatedStateListDrawableCompat

A Drawable providing animated transitions between states.


A helper class that contains several Drawables and selects which one to use.

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

Summary

Public constructors

Public methods

void
boolean
@RequiresApi(value = 21)
canApplyTheme()
void
draw(@NonNull Canvas canvas)
int
int
final Drawable.ConstantState
@NonNull Drawable
void
int
int
int
int
int

This method is deprecated.

void
@RequiresApi(value = 21)
getOutline(@NonNull Outline outline)
boolean
void
boolean
boolean
void
Drawable
boolean
onLayoutDirectionChanged(int layoutDirection)
void
scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when)
void
setAlpha(int alpha)
void
setAutoMirrored(boolean mirrored)
void
void
setDither(boolean dither)

This method is deprecated.

void

Change the global fade duration when a new drawable is entering the scene.

void

Change the global fade duration when a new drawable is leaving the scene.

void
setHotspot(float x, float y)
void
setHotspotBounds(int left, int top, int right, int bottom)
void
setTint(@ColorInt int tintColor)
void
void
boolean
setVisible(boolean visible, boolean restart)
void

Protected methods

void
boolean
onLevelChange(int level)
boolean
onStateChange(@NonNull int[] state)

Inherited methods

From android.graphics.drawable.Drawable
void
final Rect
final void
copyBounds(Rect bounds)
static Drawable
static Drawable
createFromResourceStream(
    Resources res,
    TypedValue value,
    InputStream is,
    String srcName
)
static Drawable
static Drawable
static Drawable
createFromXmlInner(
    Resources r,
    XmlPullParser parser,
    AttributeSet attrs
)
final Rect
Drawable.Callback
ColorFilter
Rect
int
final int
Insets
int[]
Region
boolean
void
void
boolean
boolean
final boolean
static int
resolveOpacity(int op1, int op2)
void
scheduleSelf(Runnable what, long when)
void
setBounds(int left, int top, int right, int bottom)
final void
void
void
setFilterBitmap(boolean filter)
final boolean
setLayoutDirection(int layoutDirection)
final boolean
setLevel(int level)
boolean
setState(int[] stateSet)
void
void

Public constructors

DrawableContainerCompat

Added in 1.6.0
public DrawableContainerCompat()

Public methods

applyTheme

@RequiresApi(value = 21)
public void applyTheme(@NonNull Resources.Theme theme)

canApplyTheme

@RequiresApi(value = 21)
public boolean canApplyTheme()

draw

Added in 1.6.0
public void draw(@NonNull Canvas canvas)

getAlpha

public int getAlpha()

getChangingConfigurations

public int getChangingConfigurations()

getConstantState

Added in 1.6.0
public final Drawable.ConstantState getConstantState()

getCurrent

public @NonNull Drawable getCurrent()

getHotspotBounds

public void getHotspotBounds(@NonNull Rect outRect)

getIntrinsicHeight

public int getIntrinsicHeight()

getIntrinsicWidth

public int getIntrinsicWidth()

getMinimumHeight

public int getMinimumHeight()

getMinimumWidth

public int getMinimumWidth()

getOpacity

Added in 1.6.0
public int getOpacity()

getOutline

@RequiresApi(value = 21)
public void getOutline(@NonNull Outline outline)

getPadding

public boolean getPadding(@NonNull Rect padding)

invalidateDrawable

Added in 1.6.0
public void invalidateDrawable(@NonNull Drawable who)

isAutoMirrored

public boolean isAutoMirrored()

isStateful

public boolean isStateful()

jumpToCurrentState

public void jumpToCurrentState()

mutate

public Drawable mutate()

onLayoutDirectionChanged

public boolean onLayoutDirectionChanged(int layoutDirection)

scheduleDrawable

Added in 1.6.0
public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when)

setAlpha

Added in 1.6.0
public void setAlpha(int alpha)

setAutoMirrored

public void setAutoMirrored(boolean mirrored)

setColorFilter

Added in 1.6.0
public void setColorFilter(ColorFilter colorFilter)

setDither

Added in 1.6.0
public void setDither(boolean dither)

setEnterFadeDuration

Added in 1.6.0
public void setEnterFadeDuration(int ms)

Change the global fade duration when a new drawable is entering the scene.

Parameters
int ms

The amount of time to fade in milliseconds.

setExitFadeDuration

Added in 1.6.0
public void setExitFadeDuration(int ms)

Change the global fade duration when a new drawable is leaving the scene.

Parameters
int ms

The amount of time to fade in milliseconds.

setHotspot

public void setHotspot(float x, float y)

setHotspotBounds

public void setHotspotBounds(int left, int top, int right, int bottom)

setTint

public void setTint(@ColorInt int tintColor)

setTintList

public void setTintList(ColorStateList tint)

setTintMode

public void setTintMode(@NonNull PorterDuff.Mode tintMode)

setVisible

public boolean setVisible(boolean visible, boolean restart)

unscheduleDrawable

Added in 1.6.0
public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what)

Protected methods

onBoundsChange

protected void onBoundsChange(Rect bounds)

onLevelChange

protected boolean onLevelChange(int level)

onStateChange

protected boolean onStateChange(@NonNull int[] state)