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?
If you want to manually handle orientation changes in your app you must declare the "orientation" , "screenSize" , and "screenLayout" values in the android:configChanges attributes. You can declare multiple configuration values in the attribute by separating them with a pipe | character.
Rotate your phone to change the screen orientation (if Auto Rotate is enabled). If Auto Rotate is enabled, your phone's screen will automatically flip to portrait mode when you are holding it upright. When you are holding it horizontally, it will automatically switch to Landscape mode.
As with almost all smartphones, Android supports two screen orientations: portrait and landscape. When the screen orientation of an Android device is changed, the current activity being displayed is destroyed and re-created automatically to redraw its content in the new orientation.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With