I have a large Text
.
Text(
text = "Select Bank account",
color = Color.White,
fontSize = 18.sp,
textAlign = TextAlign.Center,
modifier = Modifier
.background(Color.Black)
.fillMaxSize()
.padding(16.dp)
.align(Alignment.CenterHorizontally)
)
How to center the text both vertically and horizontally?
In a view-based system, we can achieve this using Gravity.CENTER
.
Looking for a similar solution.
Note
Looking for a solution without using another component wrapping the text. (Box
, Column
, etc).
I am aware that my requirement can be achieved using a wrapper component as shown here.