Question

All I want is to be able to use FragmentTransaction.replace(...) and have fragments slide into and out of place just like activities, using the default activity animation.

By default the fragments simply appear and disappear. That is an acceptable default behavior.

With FragmentTransaction.setTransition(...) I can get Fragments to fade with a slight zooming animation. That is pretty cool, but it looks nothing like what activities do.

With FragmentTransaction.setCustomAnimation(...) a clusterfuck of things happen, and it looks ugly as hell.

And now I'm out of options. All I want to do is to have fragments slide left as I push to the stack, and have fragments slide right as I pop from the stack. Anybody know how to do this short of implementing my own FragmentManager?

Was it helpful?

Solution

I have somewhat gotten around the problem by placing all of my fragments into a ViewPager. I can then setCurrentItem() to scroll between fragments. It's not pretty, and it takes a fair bit of manual effort, but it runs nice and quickly.

If there are any answers that aren't as hackish as what I've done, I'll definitely accept them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top