Any ideas how I can align the text centered? I tri...
# compose
l
Any ideas how I can align the text centered? I tried everything I'm aware of but the text doesn't move vertically except padding.
s
This centers the text fine in a box
Copy code
Box(
    modifier = Modifier.size(50.dp).background(Color.Red),
    contentAlignment = Alignment.Center
) {
    Text(text = "XXX")
}
1
you probably need to move your
paint()
to the box
c
contentAlignment
on Box is your friend