Activity Screen Rotation/Orientation

by 1:11 AM 0 comments
I was working on an app that I didn't want the activity page to rotate horizontally even if the user flips his/her phone around. So this is the code and steps I used to stop the screen from rotating/changing its orientation, however you want to call it :

1. Open AndroidManifest.xml
2. Inside AndroidManifest.xml find the activity of the screen that you don't want to rotate even if the user flips the phone:

<activity 
            android:name="com.example.MainActivity"
         
  android:label="@string/app_name"

            />


3. Add this line ->   android:screenOrientation="portrait"


<activity 
            android:name="com.example.MainActivity"
            
android:label="@string/app_name"
            android:screenOrientation="portrait"

            />



Unknown

Android Developer at Appsix LLC

I love stickers and reading books. A cool website that I've found was commitstrip.com
Currently reading: The pragmatic programmer, and The C programming language.
Currently working: an android app, and on a web project with laravel.
Im a 9gag enthusiast.
I write code at work and at home for fun or out of pure boredom.
Programming Languages that I've worked with: Java PHP C# PLSQL JavaScript
Thanks for reading.



0 comments :

Post a Comment