Compose Modifier

background

Draws shape with a solid color behind the content.

background

Source set: Common
public fun Modifier.background(color: Color, shape: Shape = RectangleShape): Modifier

Draws shape with a solid color behind the content.

Parameters

color color to paint background with
shape desired shape of the background

background

Source set: Common
public fun Modifier.background(
    brush: Brush,
    shape: Shape = RectangleShape,
    @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f,
): Modifier

Draws shape with brush behind the content.

Parameters

brush brush to paint background with
shape desired shape of the background
alpha Opacity to be applied to the brush, with 0 being completely transparent and 1 being completely opaque. The value must be between 0 and 1.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: