https://kotlinlang.org logo
#android
Title
# android
g

George Theocharis

07/30/2020, 1:40 PM
Hello all 👋 Quick question does the navigation component support shared element transitions from fragment to a second activity?
i

Ian Lake

07/30/2020, 1:58 PM
You'd want one section down for shared elements with an activity (https://developer.android.com/guide/navigation/navigation-animate-transitions#set-activity), but yeah, that's the right page :-)
g

George Theocharis

07/30/2020, 3:03 PM
Hm, have tried that way and it only fades in and out instead of moving my element on the correct position but might be a problem of timing and i need to postpone and start animations that way?
b
g

George Theocharis

07/30/2020, 3:48 PM
Are those hosted on different activities? I am from my mobile currently and it’s difficult to tell.
b

brandonmcansh

07/30/2020, 3:54 PM
ah, no single activity, fragment -> fragment. But the idea should be the same in theory.
g

George Theocharis

07/30/2020, 4:08 PM
It’s not unfortunately. I have successfully done that. But as we are migrating to nav component we have to keep some activities for the time being. So what i have now is a fragment in Activity A and then i want one element of that fragment to be transitioned to Activity B. I tried the above solutions but they only fade in/out. But i am wondering maybe it’s a timing issue.
i

Ian Lake

07/30/2020, 4:55 PM
You did read the other doc that was linked to in that documentation? There's other things you need to do at the activity level to set your shared element transition, set transition names, etc: https://developer.android.com/training/transitions/start-activity#start-with-element
The Navigation APIs are just the tip of the iceberg
4 Views