动画同时改变方向方向、动画

2023-09-06 03:25:53 作者:湖心小筑

是否有可能设置动画当我们从横向视图的活动转移到纵向视图的活动?

Is it possible to set animation when we move from an activity in landscape view to an activity in portrait view ?

推荐答案

这是可能的,但不是小事。此属性添加到您的<活性GT; 的Andr​​oidManifest.xml 文件:

It's possible, but not trivial. Add this property to your <activity> in your AndroidManifest.xml file:

android:configChanges="orientation|keyboard|keyboardHidden"

然后,覆盖您的活动的 onConfigurationChanged 并执行动画那里。

Then, override your activity's onConfigurationChanged and perform the animation there.