Block android rotation

Asked

Viewed 13,793 times

7

I developed an android app but I need it to just stand up can not lie down... What would be the best way to block the rotation ? Thank you

2 answers

14


You must go in the manifest of your project and for each Activity you must add the following line

    android:screenOrientation="portrait"

Example

 <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:label="@string/title_activity_main" >
        </activity>
  • where I put it on the manifest ?

  • In the Androidmanifest.xml file open it, in it there is an Activity tag for each Activity of your project within the tag vc adds the line I said above and as it is in the example tbm above

  • I put in the manifest and activitys , but it didn’t work

  • 1

    Now gave, was putting in wrong place XD

2

Put this in each Activity

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.