compositeTwoLayeredDrawable

open fun compositeTwoLayeredDrawable(@Nullable bottomLayerDrawable: Drawable, @Nullable topLayerDrawable: Drawable): Drawable

Composites two drawables, returning a drawable instance of LayerDrawable, with the top layer centered.

If any of the drawables is null, this method will return the other.

Parameters

bottomLayerDrawable

the drawable to be on the bottom layer

topLayerDrawable

the drawable to be on the top layer


open fun compositeTwoLayeredDrawable(@Nullable bottomLayerDrawable: Drawable, @Nullable topLayerDrawable: Drawable, @Px topLayerDesiredWidth: Int, @Px topLayerDesiredHeight: Int): Drawable

Composites two drawables, returning a drawable instance of LayerDrawable, with the top layer centered to the bottom layer. The top layer will be scaled according to the provided desired width/height and the size of the bottom layer so the top layer can fit in the bottom layer and preserve its desired aspect ratio.

If any of the drawables is null, this method will return the other.

Parameters

bottomLayerDrawable

the drawable to be on the bottom layer

topLayerDrawable

the drawable to be on the top layer

topLayerDesiredWidth

top layer desired width in pixels, or INTRINSIC_SIZE to use the intrinsic width.

topLayerDesiredHeight

top layer desired height in pixels, or INTRINSIC_SIZE to use the intrinsic height.