How to use shared element transitions in Navigation Controller

前端 未结 9 510
醉话见心
醉话见心 2021-01-31 08:06

I would like to add a shared elements transition using the navigation architecture components, when navigating to an other fragment. But I have no idea how. Also in the document

9条回答
  •  时光说笑
    2021-01-31 08:50

    I was finally able to get this to work: On Fragment B:

    val transition = TransitionInflater.from(this.activity).inflateTransition(android.R.transition.move)
    
    sharedElementEnterTransition = ChangeBounds().apply {
                enterTransition = transition
            }
    

    Just make sure you have your transition names right in your views and you have NO entertTransition on Fragment B

提交回复
热议问题