In General, it is possible but I would not suggest it.
You could use offset to shift the text relative to the background by half of the font size, but I am not sure if you can access the height of the used font here.
Text( text = start.value.format(DateTimeFormatter.ofPattern("dd. MM. HH:mm")), textAlign = TextAlign.Center, modifier = Modifier .size(150.dp, 30.dp) .background(Color.Gray, RoundedCornerShape(50)) .offset(y = fontHeightHalf) )
Use the stack instead, like:
Stack ( alignment = Alignment.Center, modifier = Modifier .size(150.dp, 30.dp) .background(Color.Gray, RoundedCornerShape(50)), ) { Text( text = start.value.format(DateTimeFormatter.ofPattern("dd. MM. HH:mm")), textAlign = TextAlign.Center ) }
Edit: Updated version to 1.0.0-alpha03
Text()component?