Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Note
titleContent Freeze

As of July 25th, 2023, there is a content freeze on this page.

For Android applications, you can limit the view of an application to either "landscape" or "potrait" exclusively; in essence disabling rotation for your application.

To do this, find the main activity in your AndroidManifest.xml (it should be visible at the bottom of your project folder in Eclipse) and add the following line:

Code Block

android:screenOrientation="portrait"

or

Code Block
  android:screenOrientation="landscape"

So, your activity section in your xml should look something like this:

Code Block

<activity
     android:name=".Common2013"
     android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
     android:label="@string/title_activity_main"
     android:screenOrientation="portrait">
     <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
</activity>

...