change layouts, but not restart activity on my Android App

隐身守侯 提交于 2019-12-13 05:47:17

问题


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.

Any help is greatly appreciated thank you.


回答1:


You can achieve this by add android:configChanges="orientation" to your activity in manifest and handle the screen contents manually by overriding onConfigurationChanged



来源:https://stackoverflow.com/questions/10235178/change-layouts-but-not-restart-activity-on-my-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!