应用程序显示屏幕旋转后,主屏 [英] App shows main screen after screen rotation

查看:345
本文介绍了应用程序显示屏幕旋转后,主屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力的andoid应用程序,因为几天。
我在我的MainActivity两个布局,第一个显示搜索盒和第二显示结果。
当该应用显示了结果和该应用取向改变时,该应用返回到第一屏幕。
我可能不是我的engish清楚,但看到这些简单的步骤:

I have been working on an andoid app since a few days. I have two layouts in my MainActivity, first one shows SearchBox and second shows the Results. When the app shows the results and the app orientation is changed, the app get back to the first screen. I may not be clear with my engish but see these simple steps :

 Open App -> 1st screen(MainActivity) -> 2nd Screen(MainActivity) -> Now If I rotate the screen It goes back to 1st screen.

我搜索一下互联网上,但我无法找到任何东西。任何帮助将是鸭preciated来解决这个问题。

I searched on internet about it, but I was unable to find anything on it. Any help would be Appreciated to solve this.

推荐答案

您应该使用的onSaveInstanceState保存状态,然后在的onCreate重新创建。

You should use onSaveInstanceState to save your state, and then recreate it in onCreate.

阅读以下的答案

恢复在屏幕上旋转

这篇关于应用程序显示屏幕旋转后,主屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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