I have a custom Transition
used in shared elements between my two Activities.
My transition doesn't work because the TransitionValues
parameters has the same View
with same attributes in both methods, captureStartValues
and captureEndValues
. So, my transition doesn't have what to do once the start and end values are the same.
Why is this happens?
In my case i wanted to transition between two element's background drawable. After a lot of digging i ended getting to the realization that the view delivered to the onCaptureStartValues method is not the actual view from the first activity but rather a representation of it created in the second activity from a parcel passed down by the transition framework.
This is counter intuitive but eventually lead me to the following article which have an informative example on how to accomplish what you're after.
https://medium.com/@belokon.roman/custom-transitions-in-android-f8949870bd63
In general you use SharedElementCallback to inject custom properties into your transition object. I really hope this kind of behavior will change in the future as it feels hack-ish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With