Function

background

Draws a solid color background behind the content.

ModifierBackgroundAndClipSample

@Sampled
@Preview
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun ModifierBackgroundAndClipSample() {
    RemoteBox(
        modifier =
            RemoteModifier.clip(RemoteRoundedCornerShape(16.rdp))
                .background(Color(0xFF1E88E5).rc)
                .padding(horizontal = 20.rdp, vertical = 12.rdp),
        contentAlignment = RemoteAlignment.Center,
    ) {
        RemoteText(text = "Clipped Background".rs, color = Color.White.rc)
    }
}
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: