改变布局,而不是重新启动活动在我的Andr​​oid应用程序 [英] change layouts, but not restart activity on my Android App

查看:108
本文介绍了改变布局,而不是重新启动活动在我的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序,从纵向到横向和布局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

这篇关于改变布局,而不是重新启动活动在我的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆