I have a strange behaviour with jetpack compose row. This is the demo code: display a row with X items and a vertical divider. Colors are for demo purpose :)
@Composable
fun StackOverflowDemo(itemList: List<Int>) {
Row(
modifier = Modifier
.height(IntrinsicSize.Min)
.background(Color.Blue)
.horizontalScroll(rememberScrollState())
) {
itemList.forEach {
Text(
it.toString(),
modifier = Modifier
.background(Color.Yellow)
.padding(horizontal = 4.dp)
)
Divider(
color = Color.Red,
modifier = Modifier
.width(1.dp)
.fillMaxHeight()
)
}
}
}
With few elements (10), this is the result
But with more elements (30), the result is wrong: the row height is not equal to the single item height, and the vertical divider is too high
Why there is such a different behaviour? What is missing in this simple setup?


