https://kotlinlang.org logo
#compose-android
Title
# compose-android
m

martmists

10/25/2023, 9:20 PM
I have a component like this:
Copy code
Column(
    verticalArrangement = Arrangement.Center,
    modifier = Modifier.fillMaxSize(),
) {
    Row { ... } // Always visible
    AnimatedVisibility(..., enter=fadeIn(), exit=fadeOut()) {
        Row { ... }  // appears on certain actions
    }
}
How do I make it so the first
Row
doesn't snap to the top when the bottom row becomes visible, but instead slowly slides to the new position? (and vice versa when the bottom becomes invisible again)
f

Francesc

10/25/2023, 10:04 PM
AnimatedVisibility
uses
Copy code
enter: EnterTransition = fadeIn() + expandVertically(),
exit: ExitTransition = fadeOut() + shrinkVertically(),
which will animate the height of the content if visible or invisible, which in turn will smoothly slide the first row. If you are replacing the transition with a simple fade, then you are losing the smooth expand/shrink
🙌 1
1
b

brandonmcansh

10/26/2023, 12:40 AM
If you need to account for the space AnimatedContent also may better serve your usecase