Search code examples
androidandroid-transitionsshared-element-transition

Get support TransitionInflater


I am working with Tranistions between fragments. I want to inflate a Tranistion to be used using:

final Transition elementEnterTransition = TransitionInflater.from(this)
   .inflateTransition(R.transition.sharedelement_enter);

This works fine after Lollipop but if I want to use the support lib

com.android.support:transition

I do not know how to inflate the transition. There is no TransitionInflater in Support lib.

I checked the documentation https://developer.android.com/reference/android/support/transition/Transition.html but no clue.

Any idea how to create Transitions from XML with Support lib?


Solution

  • Any idea how to create Transitions from XML with Support lib?

    TL;DR: You don't.

    Slightly longer answer:

    Inflating Transitions from XML is currently not implemented in the transitions support library.

    You can extend TransitionSet, set it up the way you want to use it, and then instantiate it in lieu of the one you declared in XML.