CompositeDrawable


class CompositeDrawable : Drawable, 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.

Summary

Nested types

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

Public constructors

Public functions

Unit

Adds the supplied region.

Unit
draw(canvas: Canvas)
Int
CompositeDrawable.ChildDrawable
getChildAt(index: Int)

Returns the ChildDrawable at the given index.

Int

Returns the total number of children.

Drawable.ConstantState
Drawable
getDrawable(index: Int)

Returns the Drawable for the given index.

Int

This function is deprecated.

Unit
Drawable
Unit
removeChild(index: Int)

Removes the child corresponding to the given index.

Unit

Removes the given region.

Unit
scheduleDrawable(who: Drawable, what: Runnable, when: Long)
Unit
setAlpha(alpha: Int)
Unit
setChildDrawableAt(index: Int, drawable: Drawable)

Sets the supplied region at given index.

Unit
setColorFilter(colorFilter: ColorFilter?)
Unit

Protected functions

Unit
onBoundsChange(bounds: Rect!)

Inherited functions

From android.graphics.drawable.Drawable
Unit
Boolean
Unit
Rect!
Unit
copyBounds(bounds: Rect!)
java-static Drawable!
createFromPath(pathName: String!)
java-static Drawable!
createFromResourceStream(
    res: Resources!,
    value: TypedValue!,
    is: InputStream!,
    srcName: String!
)
java-static Drawable!
createFromStream(is: InputStream!, srcName: String!)
java-static Drawable!
java-static Drawable!
createFromXmlInner(
    r: Resources!,
    parser: XmlPullParser!,
    attrs: AttributeSet!
)
Rect!
Drawable.Callback!
Int
ColorFilter!
Drawable!
Rect!
Unit
Int
Int
Int
Int
Int
Int
Insets!
Unit
getOutline(outline: Outline!)
Boolean
getPadding(padding: Rect!)
IntArray<Int>!
Region!
Boolean
Unit
inflate(r: Resources!, parser: XmlPullParser!, attrs: AttributeSet!)
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Boolean
onLayoutDirectionChanged(layoutDirection: Int)
Boolean
Boolean
java-static Int
resolveOpacity(op1: Int, op2: Int)
Unit
scheduleSelf(what: Runnable!, when: Long)
Unit
Unit
setBounds(left: Int, top: Int, right: Int, bottom: Int)
Unit
Unit
Unit
setDither(dither: Boolean)

This function is deprecated.

Unit
Unit
Unit
setHotspotBounds(left: Int, top: Int, right: Int, bottom: Int)
Boolean
setLayoutDirection(layoutDirection: Int)
Boolean
setLevel(level: Int)
Boolean
setState(stateSet: IntArray!)
Unit
setTint(tintColor: Int)
Unit
Unit
Unit
Boolean
setVisible(visible: Boolean, restart: Boolean)
Unit

Public constructors

CompositeDrawable

Added in 1.1.0
CompositeDrawable()

Public functions

addChildDrawable

Added in 1.1.0
fun addChildDrawable(drawable: Drawable): Unit

Adds the supplied region.

draw

Added in 1.1.0
fun draw(canvas: Canvas): Unit

getAlpha

fun getAlpha(): Int
Returns
Int

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

getChildAt

Added in 1.1.0
fun getChildAt(index: Int): CompositeDrawable.ChildDrawable

Returns the ChildDrawable at the given index.

getChildCount

Added in 1.1.0
fun getChildCount(): Int

Returns the total number of children.

getConstantState

fun getConstantState(): Drawable.ConstantState

getDrawable

Added in 1.1.0
fun getDrawable(index: Int): Drawable

Returns the Drawable for the given index.

getOpacity

Added in 1.1.0
fun getOpacity(): Int

invalidateDrawable

Added in 1.1.0
fun invalidateDrawable(who: Drawable): Unit

mutate

fun mutate(): Drawable

removeChild

Added in 1.1.0
fun removeChild(index: Int): Unit

Removes the child corresponding to the given index.

removeDrawable

Added in 1.1.0
fun removeDrawable(drawable: Drawable): Unit

Removes the given region.

scheduleDrawable

Added in 1.1.0
fun scheduleDrawable(who: Drawable, what: Runnable, when: Long): Unit

setAlpha

Added in 1.1.0
fun setAlpha(alpha: Int): Unit

setChildDrawableAt

Added in 1.1.0
fun setChildDrawableAt(index: Int, drawable: Drawable): Unit

Sets the supplied region at given index.

setColorFilter

Added in 1.1.0
fun setColorFilter(colorFilter: ColorFilter?): Unit

unscheduleDrawable

Added in 1.1.0
fun unscheduleDrawable(who: Drawable, what: Runnable): Unit

Protected functions

onBoundsChange

protected fun onBoundsChange(bounds: Rect!): Unit