Android: Disable screen rotation in your Activity

I have a certain activity that is designed to be run in a particular orientation, but upon testing I found that it automatically rotates to adjust itself when needed.

You'll have to do a little manifest editing in order to get this working.

Note: This will also affect the keyboard orientation in your activity.


<activity ... android:screenOrientation="portrait">

Add the android:screenOrientation attribute to your activity. You'll need to do this to all activities which you want to keep oriented.

For a full list of values, see the Android documentation.

The click-click way

  • Open up your manifest and go to the "Application" tab in Eclipse.
  • Select the activity which you wish to lock.
  • On the right, scroll down to "Screen Orientation"
  • Select the value you want.
  • Profit!
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog