Saturday, December 23, 2017

Forcing “portrait” orientation mode for android application

Adding following code segment in AndroidManifest file for each activity, we can force the android application to work only in portrait mode.

Note: Don't apply the orientation to the application element, instead you should apply the attribute to the activity element, and you must also set configChanges as noted below.


<activity
   android:screenOrientation="portrait"
   android:configChanges="orientation|keyboardHidden">
</activity>

No comments:

Post a Comment