Center items inside a Column
with ExpandedWidth
modifier:
Column(modifier = ExpandedWidth) {
Center {
Text(text = item.title)
Text(text = item.description)
}
}
Center items inside a Column
with ExpandedWidth
modifier:
Column(modifier = ExpandedWidth) {
Center {
Text(text = item.title)
Text(text = item.description)
}
}
To center items inside a Column
with ExpandedWidth
modifier, you can use the Modifier.fillMaxWidth()
modifier along with the Modifier.align()
modifier. Here’s the updated code:
Column(modifier = Modifier.fillMaxWidth().align(Alignment.CenterHorizontally)) {
Text(text = item.title)
Text(text = item.description)
}
This will center the items horizontally inside the Column
.