added in version 25.4.0
belongs to Maven artifact


public class CompositeDrawable
extends Drawable implements Drawable.Callback


Generic drawable class that can be composed of multiple children. Whenever the bounds changes for this class, it updates those of its children.


Nested classes

class CompositeDrawable.ChildDrawable

Wrapper class holding a drawable object and BoundsRule to update drawable bounds when parent bound changes. 

Public constructors


Public methods

void addChildDrawable(Drawable drawable)

Adds the supplied region.

void draw(Canvas canvas)
int getAlpha()
CompositeDrawable.ChildDrawable getChildAt(int index)

Returns the CompositeDrawable.ChildDrawable at the given index.

int getChildCount()

Returns the total number of children.

Drawable.ConstantState getConstantState()
Drawable getDrawable(int index)

Returns the Drawable for the given index.

int getOpacity()
void invalidateDrawable(Drawable who)
Drawable mutate()
void removeChild(int index)

Removes the child corresponding to the given index.

void removeDrawable(Drawable drawable)

Removes the given region.

void scheduleDrawable(Drawable who, Runnable what, long when)
void setAlpha(int alpha)
void setChildDrawableAt(int index, Drawable drawable)

Sets the supplied region at given index.

void setColorFilter(ColorFilter colorFilter)
void unscheduleDrawable(Drawable who, Runnable what)

Protected methods

void onBoundsChange(Rect bounds)

Inherited methods

From class