问题
I am trying to perform an explode transition when a user clicks on an item in a RecyclerView of a fragment that will replace the current fragment with another full-screen fragment. I have seen that the best way to implement this is through sharedElements, however, the only view that is shared between the item in the RecyclerView and the full-screen fragment is a TextView. When trying the explode transition (by using android.R.transition.explode) to expand the item up and down to make the full-screen fragment, it does not perform as expected and looks really bad. I am trying to do it by setting up an enterTransition() of the activity's window but it is not working. The code is below. I am trying to make this transition exactly as shown here: https://material.io/design/navigation/navigation-transitions.html#hierarchical-transitions. If the way I am doing this expected transition is incorrect, then how should I be implementing the transition from the link?
Fragment.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val explode = Explode()
explode.duration = 1000
activity!!.window.enterTransition = explode
}
来源:https://stackoverflow.com/questions/58981348/performing-a-transition-from-item-in-recyclerview-of-fragment-to-another-fragmen