https://kotlinlang.org logo
#compose
Title
# compose
n

nuhkoca

11/14/2022, 3:20 PM
Hello, How could I achieve animated content using Compose? (without custom layout)

https://miro.medium.com/max/1200/1*CE9Szh6jkPZA3jcnC4xBsQ.gif

g

Gustavo Pagani

11/14/2022, 3:25 PM
f

Filip Wiesner

11/14/2022, 3:29 PM
without custom layout
Why? Custom layouts are the best thing on Compose! They are really easy to work with. Learn to use them and you won't regret it 😏
k

Kirill Grouchnikov

11/14/2022, 4:13 PM
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]l3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt has reference code on how to animate and place the indicator. Take a look at
Modifier.tabIndicatorOffset
and how it integrates with the state of the currently selected tab.
t

Tolriq

11/14/2022, 4:16 PM
I use a variation inspired by the code from the medium article you took that animation from and it works perfectly fine and is easy to maintain once you take time to read the article and understand how things works.https://fvilarino.medium.com/creating-an-animated-selector-in-jetpack-compose-669066dfc01b
i

Ian G. Clifton

11/14/2022, 7:27 PM
The Crane sample slides an outline as a selection indicator that is pretty similar https://github.com/android/compose-samples/tree/main/Crane
c

Colton Idle

11/14/2022, 8:25 PM
@Zach Klippenstein (he/him) [MOD] also had something like this shared on his twitter (which I can't find right now) sorry for the ping.
z

Zach Klippenstein (he/him) [MOD]

11/14/2022, 8:38 PM
you can’t find it because my twitter account no longer exists, unfortunately
c

Colton Idle

11/14/2022, 9:23 PM
DAMN YOU ELONNNNNNN
d

Dmitry Strekha

11/15/2022, 10:20 AM
z

Zach Klippenstein (he/him) [MOD]

11/15/2022, 1:20 PM
Lol wtf I couldn’t even find that in my own gists yesterday. Fixed the name
d

Dmitry Strekha

11/15/2022, 3:03 PM
I just google everytime I need it 😁 ¯\_(ツ)_/¯
201 Views