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

James picture James · Sep 16, 2010 · Viewed 252.7k times · Source

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

Answer

Cristian picture Cristian · Sep 16, 2010

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.