How do I disable orientation change on Android?

后端 未结 12 1004
一向
一向 2020-11-22 02:45

I have an application that I just would like to use in portrait mode, so I have defined android:screenOrientation=\"portrait\" in the manifest XML. This works OK for the HTC

12条回答
  •  失恋的感觉
    2020-11-22 03:11

    In the AndroidManifest.xml file, for each activity you want to lock add the last screenOrientation line:

    android:label="@string/app_name"
    android:name=".Login"
    android:screenOrientation="portrait" >
    

    Or android:screenOrientation="landscape".

提交回复
热议问题