I want the AnnotatedString
in the Box
Composable below to display in the middle of the screen and centered, but the text is aligned to the left, although it displays in the middle of the screen. How can I fix this?
Box(
modifier = Modifier.fillMaxSize(),
) {
val emptyMessage = AnnotatedString(
text = "You don't have any items in this list. Click the ",
spanStyle = SpanStyle(Color.Gray)
).plus(
AnnotatedString(
text = "+ ",
spanStyle = SpanStyle(Color.Gray, fontSize = 18.sp),
)
).plus(
AnnotatedString(
text = "button below to add an item.",
spanStyle = SpanStyle(Color.Gray)
)
)
Text(
modifier = Modifier.align(Alignment.Center),
text = emptyMessage,
)
}