How to Lock Android App's Orientation to Portrait in Phones and Landscape in Tablets?

前端 未结 9 1671
自闭症患者
自闭症患者 2020-12-02 08:44

I am developing an Android app whose orientation I don\'t want changed to landscape mode when the user rotates the device. Also, I want the locked orientation to be portrait

9条回答
  •  时光取名叫无心
    2020-12-02 09:11

    You have to add the android:screenOrientation="portrait" directive in your AndroidManifest.xml. This is to be done in your tag.

    In addition, the Android Developers guide states that :

    [...] you should also explicitly declare that your application requires either portrait or landscape orientation with the element. For example, .

提交回复
热议问题