added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0-beta01

CompositeDrawable

public class CompositeDrawable
extends Drawable implements Drawable.Callback

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ androidx.leanback.graphics.CompositeDrawable


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

Summary

Nested classes

class CompositeDrawable.ChildDrawable

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

Public constructors

CompositeDrawable()

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

Public constructors

CompositeDrawable

added in version 1.0.0
public CompositeDrawable ()

Public methods

addChildDrawable

added in version 1.0.0
public void addChildDrawable (Drawable drawable)

Adds the supplied region.

Parameters
drawable Drawable

draw

added in version 1.0.0
public void draw (Canvas canvas)

Parameters
canvas Canvas

getAlpha

public int getAlpha ()

Returns
int Alpha value between 0(inclusive) and 255(inclusive)

getChildAt

added in version 1.0.0
public CompositeDrawable.ChildDrawable getChildAt (int index)

Returns the CompositeDrawable.ChildDrawable at the given index.

Parameters
index int

Returns
CompositeDrawable.ChildDrawable

getChildCount

added in version 1.0.0
public int getChildCount ()

Returns the total number of children.

Returns
int

getConstantState

public Drawable.ConstantState getConstantState ()

Returns
Drawable.ConstantState

getDrawable

added in version 1.0.0
public Drawable getDrawable (int index)

Returns the Drawable for the given index.

Parameters
index int

Returns
Drawable

getOpacity

added in version 1.0.0
public int getOpacity ()

Returns
int

invalidateDrawable

added in version 1.0.0
public void invalidateDrawable (Drawable who)

Parameters
who Drawable

mutate

public Drawable mutate ()

Returns
Drawable

removeChild

added in version 1.0.0
public void removeChild (int index)

Removes the child corresponding to the given index.

Parameters
index int

removeDrawable

added in version 1.0.0
public void removeDrawable (Drawable drawable)

Removes the given region.

Parameters
drawable Drawable

scheduleDrawable

added in version 1.0.0
public void scheduleDrawable (Drawable who, 
                Runnable what, 
                long when)

Parameters
who Drawable

what Runnable

when long

setAlpha

added in version 1.0.0
public void setAlpha (int alpha)

Parameters
alpha int

setChildDrawableAt

added in version 1.0.0
public void setChildDrawableAt (int index, 
                Drawable drawable)

Sets the supplied region at given index.

Parameters
index int

drawable Drawable

setColorFilter

added in version 1.0.0
public void setColorFilter (ColorFilter colorFilter)

Parameters
colorFilter ColorFilter

unscheduleDrawable

added in version 1.0.0
public void unscheduleDrawable (Drawable who, 
                Runnable what)

Parameters
who Drawable

what Runnable

Protected methods

onBoundsChange

protected void onBoundsChange (Rect bounds)

Parameters
bounds Rect