How can I clip the bottom of a composable, so that...
# compose
How can I clip the bottom of a composable, so that it's not higher than a given size? This seems very simple but I can't find a simple solution. I wrote a custom layout and that works, but surely there is an easier way.
This thread might be what you are looking for By default when an item is bigger than its parent, it gets centered on it. Doing what Albert is suggesting here you can wrapContentHeight and give it the alignment you want (Alignment.Top in your case I presume) while making sure you pass your
unbounded = true
. Other than that, doing a custom layout is also an option as you say. Here’s how I did this to cut a specific amount from the top and from the bottom of an item that was bigger than what I wanted it to be for example.
Thank you,
wrapContentHeight(align = <http://Alignment.Top|Alignment.Top>, unbounded = true)
was what I needed. Much simpler than my custom layout. 😄
Yeap, I was in the exact same situation. I did a complex layout solution, then Albert came and saved the day, as usual 😅