Lock Android phone application in portrait mode

Can someone tell me how to lock my app in portrait mode? Is this a simple configuration in the manifest file?

+77
android portrait
Feb 18 '11 at 17:31
source share
3 answers

Yes. Add android:screenOrientation="portrait" to the manifest under your main activity.

 <activity android:name=".yourActivity" android:screenOrientation="portrait"... /> 
+183
Feb 18 2018-11-18T00:
source share

Yes! This is an attribute of an activity tag:

 <activity android:name=".yourActivity" android:screenOrientation="portrait" ... /> 
+66
Feb 18 '11 at 17:35
source share

In addition, you may need to add the following to your activity element:

 android:configChanges="keyboardHidden" 

Thus, the OS will not change orientation when the user opens the sliding keyboard.

+10
Feb 18 '11 at 19:48
source share



All Articles