Hey, I've got a Row with an Image and Column insid...
# compose
g
Hey, I've got a Row with an Image and Column inside, the image fills a certain height, but the Column wont fill the height row
Column(modifier = Modifier.fillMaxSize()
Thread in Slack Conversation
a
can u post the whole code ? cant think of whats wrong with this approach
g
Copy code
val image = imageResource(player.avatar)
Row(verticalAlignment = Alignment.CenterVertically, modifier = modifier.fillMaxSize().padding(5.dp)) {
	Image(image, modifier = Modifier.preferredWidth(128.dp).background(color = red900, shape = RoundedCornerShape(topLeft = 10.dp, bottomLeft = 10.dp)).padding(5.dp))
	Column(modifier = Modifier.fillMaxSize().background(color = red500, shape = RoundedCornerShape(topRight = 10.dp, bottomRight = 10.dp)).padding(5.dp)) {
		Text(text = player.name, softWrap = false, fontSize = 28.sp, fontWeight = FontWeight.Bold)
		Text(text = "Score: ${player.score} Wins: ${player.wins}", fontSize = 16.sp)

	}
}
I would expect the column to fill the whole height of the row
a
I guess the problem here is that you’re not specifying how high you want this row to be. If you want the column to be as high as the image gets, maybe you could use a ConstraintLayout and constraint the top and the bottom of the column to the respective top and bottom of the image.
g
Yeh I guess, I'd just figure fillMaxSize would, you know, fill to max size 😆
y
Copy code
Column(Modifier.preferredWidth(IntrinsicSize.Max)) {
    ButtonText(fillMaxSize)
    ButtonText(fillMaxSize)
}
something like that should work, the key point is the use
IntrinsicSize.Max
g
Ah I'll give that a try, thanks
y
Copy code
Row(
    modifier = Modifier
        .fillMaxWidth()
        .preferredHeight(IntrinsicSize.Max)
Use this in the row and this on the column:
Copy code
fillMaxHeight()
I have this in my app, working fine 😉
g
That seems to shrink the height of the row rather than expand the height of the column to fill the row