Home > Back-end >  How to set the screen to not rotate (android)?
How to set the screen to not rotate (android)?

Time:10-16

I created an android app which requires the screen to be only in portrait mode. While typing the IDE showed only this for orientation.

android:orientation="vertical"

The above code actually worked in the emulator. But when I checked it on a physical device. The app is rotating to landscape even with that code. How do I solve this?

I checked for screenOrientation is not working. Thanks in advance

CodePudding user response:

Add this line in your manifest android:screenOrientation="portrait"

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

For Example :

enter image description here

  • Related