【问题标题】:How to set the screen to not rotate (android)? [duplicate]如何将屏幕设置为不旋转(android)? [复制]
【发布时间】:2021-10-15 13:47:22
【问题描述】:

我创建了一个 Android 应用,它要求屏幕仅处于纵向模式。 在输入 IDE 时,仅显示此作为方向。

android:orientation="vertical"

上面的代码实际上在模拟器中工作。但是当我在物理设备上检查它时。即使使用该代码,该应用程序也会旋转到横向。我该如何解决?

我检查了 screenOrientation 没有工作。 提前致谢

【问题讨论】:

  • 在清单中使用 android:screenOrientation="portrait" 进行活动
  • screenOrientation 也不起作用。

标签: android screen orientation


【解决方案1】:

在清单中添加这一行 android:screenOrientation="portrait"

<activity
    android:name=".LoginActivityKt"
    android:screenOrientation="portrait"/>

例如:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-17
    • 2021-02-28
    • 2012-02-20
    • 1970-01-01
    相关资源
    最近更新 更多