Android: Disable screen rotation in your Activity

1 comment

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.

Manually

<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!

Related Posts

1 comment:

  1. again thanks, good help!

    regards,
    jonnyhope

    ReplyDelete

Leave your thoughts ...
---
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'. For more information about this Firefox bug, see here.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog