shared element transition works with FragmentTransaction.replace() but doesn't work with FragmentTransaction.add()

前端 未结 3 666
囚心锁ツ
囚心锁ツ 2020-12-14 16:54

The new Shared Element Transitions works when i use Fragment \'replace\' but i can\'t seem to make it work fragment \'add\'. I use the same container in bo

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 17:49

    I guess it is because the new fragment is placed on top of the old fragment. The old fragment is not being placed out of the controller and onPause (and sequenced methods) aren't being called. It doesn't play any transitions because the old fragment might still be visible to the user (the system doesn't know that).

    In my answer (where you commented) I added an enter and exit transition. If you add it, does it even animate? If not, it's probably because of the stated reason.

提交回复
热议问题