I want my android application to be only run in portrait mode?


Question

I want my android application to be only run in portrait mode? How can I do that?

1
320
11/27/2017 5:20:04 PM

Accepted Answer

In the manifest, set this for all your activities:

<activity android:name=".YourActivity"
    android:configChanges="orientation"
    android:screenOrientation="portrait"/>

Let me explain:

  • With android:configChanges="orientation" you tell Android that you will be responsible of the changes of orientation.
  • android:screenOrientation="portrait" you set the default orientation mode.
709
9/16/2010 4:54:41 AM

In Android Manifest File, put attribute for your <activity> that android:screenOrientation="portrait"


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon