Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Jetpack Compose component(s) used:
"androidx.constraintlayout:constraintlayout-compose:1.0.1"
Steps to Reproduce or Code Sample to Reproduce:
So I had similar issue implementing the following
There is answer
But it stops working as soon as you use `ConstraintLayout`:
@Composable
fun Test() {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.background(
Color.White,
RoundedCornerShape(16.dp)
)
.clip(RoundedCornerShape(16.dp))
.height(IntrinsicSize.Min) //Intrinsic measurement
) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.background(Color.Green)
.width(20.dp)
.fillMaxHeight() //<--- fill max height
) {
//
}
ConstraintLayout(modifier = Modifier.weight(1f).background(Color.Red)) {
val (title, perHour) = createRefs()
Text(
text = "Title",
color = Color.White,
modifier = Modifier
.constrainAs(title) {
width = Dimension.preferredWrapContent
top.linkTo(parent.top, 16.dp)
linkTo(
start = parent.start,
end = perHour.start,
bias = 0f,
startMargin = 10.dp,
endMargin = 12.dp
)
}
)
Text(
text = "£20.87/H",
modifier = Modifier
.constrainAs(perHour) {
top.linkTo(parent.top, 16.dp)
end.linkTo(parent.end, 24.dp)
}
)
}
}
}
The Box's height has become higher than height of second child (ConstraintLayout, if I use any other (Box/Row/Column) instead then it works fine)
Also `ConstraintLayout` doesn't take all the available width of `Row` even if `weight` is set to `1f`
[1]: