Android Activity 屏幕方向 onResume
我有一个相当简单的应用程序,主要的 LinearLayout 将其方向设置为水平并包含一些视图。活动 screenOrientation
设置为横向。启动一切看起来都正常。如果我暂时离开手机&当我遇到问题时让屏幕锁定。当我关闭屏幕锁定时,活动会重新出现,但以纵向模式显示,LinearLayout
中的所有视图都显示在一起。如果我什么都不做,那么 1 或 2 秒后应用程序会切换回横向和横向模式。正确地布置了一切。
我怎样才能阻止这种情况发生?我想如果我将活动 screenOrientation
设置为横向,它就会保持横向。这是因为我在代码中做错了什么,还是 Android 中的错误?我的手机使用的是 Android 2.2.1。
谢谢。
I've got a rather simple app, the main LinearLayout has its orientation set to horizontal and contains a few views. The activity screenOrientation
is set to landscape. Starting it everything looks OK. If I leave my phone for a while & let the screen lock thats when I get problems. When I swipe the screen lock off, the activity reappears but is showing in portrait mode with all the views in the LinearLayout
showing all squashed up together. If I do nothing at all then after 1 or 2 seconds the app switched back to landscape & lays out everything correctly.
How can I stop this happening ? I thought if I set the activity screenOrientation
to landscape it would stay in landscape. Is this because I am doing something wrong in my code, or is it a bug in Android ? I'm using Android 2.2.1 on my phone.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论