【问题标题】:Portrait app shows as Landscape纵向应用显示为横向
【发布时间】:2015-07-07 11:45:00
【问题描述】:

我是一名 Android 开发人员,最近为客户制作了一个应用程序。屏幕方向应该只能是纵向的,所以我在清单中的每个活动中都添加了选项android:screenOrientation="userPortrait"

尽管如此,我的客户一直告诉我,该应用程序在她的三星平板电脑上以横向显示。我不知道为什么会这样,根据http://developer.android.com/guide/topics/manifest/activity-element.html,方向永远不应该是横向的。在我的所有测试中,它都正确显示(纵向模式),但我无法访问她的设备,也不知道发生了什么。

任何帮助将不胜感激。谢谢!

【问题讨论】:

  • 有答案后请关闭您的问题。

标签: android landscape portrait


【解决方案1】:

你应该这样写:

android:screenOrientation="portrait"

【讨论】:

  • 正如我在文档中看到的,android:screenOrientation="userPortrait" 也是纵向的。为什么android:screenOrientation="portrait" 是更好的选择,它是如何解决问题的?