Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return transition doesn't work #15

Open
MHKalantarian opened this issue Dec 29, 2018 · 1 comment
Open

Return transition doesn't work #15

MHKalantarian opened this issue Dec 29, 2018 · 1 comment

Comments

@MHKalantarian
Copy link

I have nested fragments inside a fragment and it works perfect when I enter the second fragment. But when I pop back stack to return to the first fragment it just normally returns without any animation or move or anything, like no shared elements ever defined. Also I'm using cardview for my recycler items layout.

@razaghimahdi
Copy link

i know it's too late but maybe this be useful, so just add this to fragmentA(which list is there):

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

         postponeEnterTransition()
        val parentView = view.parent as ViewGroup
        parentView.viewTreeObserver
            .addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener {
                override fun onPreDraw(): Boolean {
                    parentView.viewTreeObserver.removeOnPreDrawListener(this)
                     startPostponedEnterTransition()
                    return true
                }
            })
        super.onViewCreated(view, savedInstanceState)
 


    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants