I am trying to create a row of two buttons in Jetpack Compose, and I want each button to wrap its own content, which is the text "HELLO". I have achieved this by using the .defaultMinSize() modifier on each button. However, I am having trouble getting the row to wrap around its content, which is the two buttons. I have used the .wrapContentSize() modifier on the Row composable, but the height of the row is not adjusting to the height of the buttons as shown in the image.
Row(
horizontalArrangement = Arrangement.SpaceEvenly,
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.wrapContentSize()
.background(LightGrey)
) {
Button(
modifier = Modifier
.defaultMinSize(minWidth = 1.dp, minHeight = 1.dp)
,
onClick = { /*TODO*/ },
contentPadding = PaddingValues(0.dp)
) {
Text(
text = "HELLO",
)
}
Button(
modifier = Modifier
.defaultMinSize(minWidth = 1.dp, minHeight = 1.dp)
,
onClick = { /*TODO*/ },
contentPadding = PaddingValues(0.dp)
) {
Text(
text = "HELLO",
)
}
}

