1

I have a rather weird problem. Everything is working as it should except for this little thing. I'll show the code.

// ...lots of other code
ft.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left, R.animator.slide_in_right, R.animator.slide_out_left);
ft.addToBackStack(null);
// ... some more code

It's pretty simple, when I click a button that replaces a fragment with another fragment an animation between the two is played out. This works dandy! And as you see, the same animation is presented when I press the back button.

It all works! Until... I change orientation. Let's say I'm at the third fragment, change orientation and press the back button, the animation does not play out. The previous fragment is displayed instantly. When I click a menu button again to the third fragment the animations all of a sudden start to work again.

I'm guessing this has something to do with the Bundle, as when you change orientation the Activity is stopped, then started and the savedInstance being "reinserted". However the savedInstance animation was made for portrait and not landscape. Or it's simply just not saving the setCustomAnimations().

Is this a bug or is this how it is supposed to be?

4

1 回答 1

1

据我所知,这是本机库和支持库中报告的错误。看看这个问题,或者在这里寻求一些建议。我在第二个链接中尝试了最后一个建议,现在效果很好。

于 2013-10-20T10:34:43.467 回答