Search code examples
javaandroidandroid-layoutandroid-orientation

Setting Multi Orientation - Android


I'm new at android programming and I've got a problem with orientation.

I want my activities only to be viewable in the portrait and reverse-portrait and orientations.

I thought android:screenOrientation="portrait|reversePortrait" would work but it is not working. Is there have any way to do this in the manifest file?


Solution

  • Please check the documentation: http://developer.android.com/guide/topics/manifest/activity-element.html#screen

    In API 9+ added that portrait orientation, but can be either normal or reverse portrait based on the device sensor. So you can use android:screenOrientation="sensorPortrait" for both.