This is how I want this to look like
Notice that the text is always a number.
How can I align the top of the Heart to the red line (top of text)?
If I can remove the font padding (over the red line and below the number) this also could work for me fine but I do not know how to do this.
This is my code
Row {
Text(
pulse.toString(),
modifier = Modifier
.background(Color.Gray),
fontSize = 60.sp,
color = vitalModifier.color)
Spacer(modifier = Modifier.width(10.dp))
Icon(
modifier = Modifier
.background(Color.Green)
.alignBy(LastBaseline),
painter = painterResource(R.drawable.ic_heart),
contentDescription = null,
tint = vitalModifier.color)
}
You can use BadgedBox to achieve this
BadgedBox(badge = { Badge { Text("8") } }) {
Icon(
Icons.Filled.Favorite,
contentDescription = "Favorite"
)
}
https://dev.to/farhanroy/jetpack-compose-badge-18ho
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With