Android L introduced a new animations feature: animating between similar Views in different activities. It's documented here.
I've tried to use ActivityOptions.makeSceneTransitionAnimation
, but it doesn't seem to be visible in the SDK (or in the jar at all), so I tried using reflection, and it returns a null value.
Has anyone else got it working?
Okay, I got it working.
It seems like setting the value in styles.xml is completely ignored for now.
You'll need to do this in each Activity's onCreate till that's fixed
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition transition = // load transition here.
getWindow().setSharedElementEnterTransition(transition);
getWindow().setSharedElementExitTransition(transition);
As per the same bug ViewAnimationUtils has, you'll see errors in Android Studio, it'll compile and run fine though.
We can got it working with theme config for v21. Put these items into res/values-v21/styles.xml
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
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