Sitemap

Member-only story

Android Compose Code Snippets part 3

4 min readApr 9, 2025

Card example:

@Preview(showSystemUi = true)
@Composable
fun UserCardRow() {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.End,
modifier = Modifier.background(Color.Green)
) {
Box {
Image(
painterResource(R.drawable.ic_launcher_foreground),
contentDescription = "User image"
)
Icon(
Icons.Filled.Check,
contentDescription = "Check mark",
modifier = Modifier.align(Alignment.BottomEnd)
)
}
Column {
Text("Andres Sand")
Text("one minute")

OutlinedButton(onClick = { /* handle click */ }) {
Text("Button")
}
}
}
}

Use modifiers

/**
* Composable function that displays a user card in a row layout.
*
* This card includes a user image with a checkmark icon, user information in a column,
* and an outlined button. The row is clickable and has a green background.
*
* code sample https://developer.android.com/develop/ui/compose/layouts/basics
*
*/
@Preview(showSystemUi =…

--

--

Andres Sandoval
Andres Sandoval

Written by Andres Sandoval

I'm a passionate Android Software Engineer with over 11 years of experience. andresand.github.io/andres-about-me/ buymeacoffee.com/andresand

No responses yet