【问题标题】:Nexus 4 , Galaxy Nexus AVD - Landscape not workingNexus 4,Galaxy Nexus AVD - 风景不工作
【发布时间】:2013-11-17 11:14:29
【问题描述】:

我正在尝试在不同的设备上测试我的应用,但在使用 Nexus 4 和 Nexus Galaxy 模拟器时遇到了问题。他们正在做与我期望他们做的相反的事情,他们锁定的是纵向而不是横向。

<activity
    android:name="org.myApp.Main"
    android:screenOrientation="userLandscape" 

我已经在 Nexus 7,10 和 1 的设备和模拟器上进行了测试,它们都很好。

这是模拟器的问题还是这些设备不同。很遗憾,我现在没有可用于测试的设备。

【问题讨论】:

    标签: android android-layout android-emulator


    【解决方案1】:

    你可以测试

     android:screenOrientation="landscape"
    

    在这里查看 userLandscape 和 Landscape 之间的区别:

    http://developer.android.com/guide/topics/manifest/activity-element.html#screen

    【讨论】:

    • 大卫你和我同时回答。横向确实有效,但不确定为什么用户横向不“userLandscape”横向方向,但可以是基于设备传感器和用户传感器偏好的正常或反向横向。如果用户已锁定基于传感器的旋转,则其行为与景观相同,否则其行为与 sensorLandscape 相同。在 API 级别 18 中添加。
    • 我会试试sensorLandscape
    【解决方案2】:

    我只是尝试更改为 Landscape 而不是 userLandscape,现在看起来还可以。 android:screenOrientation="风景"

    我的问题是我的 AVD 运行 API 17 而用户 userLandscape 是 18

    SensorLandscape 最适合我。

    【讨论】:

    • David 我必须将自己的答案标记为正确,因为它提供了更多细节。但是感谢您的帮助
    • 感谢您提供此信息。这真的很有用,我还没有意识到发生了什么。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-22
    • 2012-04-27
    • 2013-01-15
    • 1970-01-01
    • 2015-09-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多