In case you are wondering why your custom animations do not work when used with fragments as opposed to using them in Activity transitions, the answer is you cannot.

Google framework engineer Dianne Hackborn had this to say:

“The Z adjustment only works for window animations. I thought this was documented, but apparently not.” — Dianne Hackborn (Android framework engineer).

I forgot which forum I found this XML code for creating an animation of Activity transition shrinking from all sides to the middle. You know, like the effect in iPhone. The problem was, the result did not work.

For the Activity that is assigned this transition, you would want the new Activity to still appear and have the old one shrink to middle. It took me quite a bit to figure this out.

For this effect to properly work, you need to add the attribute android:zAdjustment=”top” to ensure that the old Activity will be displayed to front, shrinking to the middle while the new Activity stays idle in the background.

Here is the XML code.

Related Posts Plugin for WordPress, Blogger...