Block android rotation [duplicate]

5

I've developed an android app but I just need it to stand and can not lie down ... What's the best way to block the rotation? Thanks

    
asked by anonymous 19.11.2015 / 02:49

2 answers

10

You should go in the manifest of your project and for each activity you should add the following line

    android:screenOrientation="portrait"

Example

 <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:label="@string/title_activity_main" >
        </activity>
    
19.11.2015 / 02:52
3

Put this in each Activity setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    
06.11.2016 / 04:14