Is it possible to specify the vertical aligment of...
# compose
p
Is it possible to specify the vertical aligment of a container (LazyRow in this case) by a percentage of the height of the container? for example, 20% of the height. I only can find default ways like
verticalAlignment = Alignment.CenterVertically
e
Its not clear what you mean. Can you pseudocode an example?
Copy code
Row(verticalAlignment = Alignment.CenterVertically) {
  A(Modifier.align(Alignment.Bottom))
  B()
  C()
}
In this example above
vertical alignment
would affect ABC causing them to be centered by default, but
align
would override A causing it to move towards the bottom
Do you want to set a vertical alignment on the container that would cause ALL children to be 20% height away from the top?
Or do you want that for just one child only within the Row
p
yes, all the row childrens must be at 20% of the height
e
Okay, you can implement a simple custom
Alignment.Vertical
Copy code
fun interface Vertical {
  fun align(size: Int, space: Int) = (0.2f * space).toInt()
}
if you want to align the top of the child. If you’d rather align the center you would update it with a little calculation that takes account of the
size
p
well finally I did it using BiasAligment.Vertical but thank you
👍🏾 1