Zoltan Demant
01/12/2023, 9:59 AMText composables in a `Column`:
x
Hello
y
How can I keep Hello centered, despite x and/or y animating out of existence sometimes? Custom layout?Abhishek Sharma
01/12/2023, 10:07 AMModifier.gravity(Alignment.Center) .
Something like this
Column {
Text(text = "x", modifier = Modifier.animate(visibility = xVisibility))
Text(text = "Hello", modifier = Modifier.gravity(Alignment.Center))
Text(text = "y", modifier = Modifier.animate(visibility = yVisibility))
}
P.S: I didn't test it.Zoltan Demant
01/12/2023, 10:13 AMZun
01/12/2023, 10:15 AMZoltan Demant
01/12/2023, 10:16 AMZoltan Demant
01/12/2023, 10:17 AMAbhishek Sharma
01/12/2023, 10:23 AMrobercoding
01/12/2023, 11:07 AM0.sp to 16.dp?
But I see possible solutions like:
• Measuring the height previously and then setting it each single item its own size?
• Or maybe graphics layer to not affect other content layout positions?Zoltan Demant
01/12/2023, 12:06 PMif (visible) {}. One thing that complicates things quite a bit is that x & y might not be visible initially, so measuring doesnt really work, the middle item will move down to account for x being visible, etc. I think Layout is my only option?Zoltan Demant
01/12/2023, 12:13 PMModifier
.heightIn(minHeight)
.onPlaced { coordinates ->
minHeight = minHeight.coerceAtLeast(coordinates.size.height.dp)
},Colton Idle
01/12/2023, 1:37 PMColton Idle
01/12/2023, 1:38 PMRebecca Franks
01/12/2023, 1:48 PMColton Idle
01/12/2023, 2:19 PMZoltan Demant
01/12/2023, 2:44 PM