Does compose offer something similar to `android:a...
# compose
j
Does compose offer something similar to
android:animateLayoutChanges="true"
?
j
Thanks, that improves a bit! I’m adding items dynamically to a
ScrollableColumn
and adding
.animateContentSize
makes the column resize more nicely, is there an equally easy way to also add fade in/out transitions to the individual column elements?
m
i’m working on the same thing right now. I just aded this animateContentSize to a child in column
j
No luck so far, doesn’t animate much, perhaps I’m missing something, dunno what tho.
m
Copy code
Crossfade(
                stateOrModelOrSth,
                modifier = Modifier.animateContentSize(tween(1000)),
                animation = keyframes {
                    durationMillis = 3000
                    0.01f at 1000
                    1f at 3000

                }
            ) {
                YourComposable(stateOrModelOrSth)
            }
👍 1
didn’t know how to create delay
d
Re: @julioromano Have you tried AnimatedVisibility for transitioning in/out children? Crossfade is a great option too. 🙂
Re: @Mikołaj Kąkol delay can be achieved with
tween
as such:
Copy code
tween(delayMillis = 100, durationMillis = 200)
👍 1
j
Thanks! But I think I’m trying the wrong approach. I’m replacing a
RecyclerView
which has animations when the list content changes (thanks to
DiffUtil
) with a
ScrollableColumn
but can’t get similar animations when changing content. Perhaps that’s simply not possible with
ScrollableColumn
. In case you are wondering why I’m not using
LazyColumn
instead, it’s because that
RecyclerView
was overkill: it managed a relatively small set of items so I thought that view recycling wasn’t necessary when rewriting it in Compose, but probably the nice animations we get almost for free using
DiffUtil
are simply not possible with
ScrollableColumn
?