问题描述
我想我的应用程序,从纵向到横向和布局1更改为布局2,但不重新启动该活动。
它从布局1到布局2很好,但每次从纵向到横向和横向到纵向切换时重新启动活动,我想只要运行活动一次,然后它保留下来。
I want my app to go from portrait to landscape and change from layout1 to layout2 but not restart the activity.
It goes from layout1 to layout2 nicely, but restarts the activity every time it switches from portrait to landscape and landscape to portrait and i want to just run the activity once then keep it there.
任何帮助是极大的AP preciated谢谢你。
Any help is greatly appreciated thank you.
推荐答案
您可以做到这一点通过添加安卓configChanges =定向
您的清单中的活动和处理手动屏幕内容通过覆盖 onConfigurationChanged
You can achieve this by add android:configChanges="orientation"
to your activity in manifest and handle the screen contents manually by overriding onConfigurationChanged
这篇关于改变布局,而不是重新启动活动在我的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!