1

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?

4

1 回答 1

0

通过将所有片段放入 ViewPager 中,我在一定程度上解决了这个问题。然后我可以 setCurrentItem() 在片段之间滚动。它并不漂亮,而且需要相当多的手动操作,但它运行得又快又好。

如果有任何答案不像我所做的那样骇人听闻,我一定会接受。

于 2011-09-06T21:36:56.310 回答