How to start shared element transition using Fragments?

前端 未结 8 1404
心在旅途
心在旅途 2020-12-04 06:32

I am trying to implement transitions between fragments which have \"shared elements\" as described in the new material design specs. The only method I can find is the Activi

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 07:21

    Shared elements do work with Fragments but there are some things to keep in mind:

    1. Don't try to set the sharedElementsTransition in the onCreateView of your Fragment. You have to define them when creating an instance of your Fragment or in onCreate.

    2. Take note of the official documentation on the possible animations for enter/exit transitions & sharedElementTransition. They are not the same.

    3. Trial and error :)

提交回复
热议问题