How to lock an Android apps orientation in Android Studio


A step by step guide for limiting an Android device's orientation to landscape, portrait or another orientation within an app.
Step One: Open the Android Manifest

In the project, Open the AndroidManifest.xml file.
Step Two: Lock the Orientation of the Activity

Under each activity set the desired orientation using code similar to that below.
android:screenOrientation='portrait'
Step Three: Test

Run the app and confirm that the app is locked to the orientation.
Any Questions?
We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.