문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top