Search code examples
androidanimationandroid-fragmentsfragmenttransaction

Built in Fragment Transitions


I have been trying to test the built in Fragment Transitions located here but I do not understand what is going on in the animations (CLOSE, FADE, and OPEN).

More specifically, what is the animation being used for the built in fragment transaction animations? I'm guessing fade is simply cross fading the two, but even when I have tested close and open I cannot figure out what they are doing just by watching them.

I have checked the source code but cannot find the animation files that are being referenced.

Links and tips for figuring this out are also appreciated!


Solution

  • The FragmentTransaction constants you are referring to (TRANSIT_FRAGMENT_OPEN, etc.) are used in the framework to built in animations. They vary by the theme in use and what is bundled by the OEM. For example, the OPEN transaction uses this in AOSP code:

    com.android.internal.R.styleable.FragmentAnimation_fragmentOpenEnterAnimation

    That will map to a specific animation by the OEM.