with two composables of different height and use `AnimateVisibility`/`AnimateContent` so that one of them is removed, what is the best way to make this
? Otherwise layout content jumps which doesn't look good.
➕ 2
d
Doris Liu
08/26/2021, 4:23 PM
You could configure
contentAlignment
for
AnimatedContent
to center the content of different height.
Combined with the default size animation it should give you a smooth change of the content instead of jump.
d
dimsuz
08/26/2021, 5:48 PM
Animation itself is smooth. The problem is that after animation is finished all content which is underneath the animated Layout is shifted up or down. And I want it to stay in place.
I drew this rough picture to explain 🙂
d
Doris Liu
08/26/2021, 6:24 PM
😄 Thanks for the diagram. If there is a guarantee that large content will show first, you could create a layout modifier that returns the largest height seen in the MeasureResult. But if either one can show first, you won't know the size of something that isn't in the tree.