Reputation: 205
I want my android studio app to be landscape only, but to switch orientation when the phone is rotated.
This means that when u flip the phone 180°, it will still be landscape but will flip sides. Like the clash of clans game.
Upvotes: 3
Views: 5211
Reputation: 188
All you need is to go to your AndroidManifest.xml file and under each Activity add the screen orientation tag and set it to sensorLandscape. Make sure you do it for all the other activities if you want them to be in landscape too.
For Example :
<activity
android:name=".MainActivity"
android:label="@string/title_MainActivity"
android:screenOrientation="sensorLandscape">
</activity>
Upvotes: 3
Reputation: 15414
You should add the sensorLandscape
screenOrientation
tag to your activity in the android manifest file and you should be good to go.
android:screenOrientation="sensorLandscape"
Make sure to add this to all the activities that you want to have in landscape mode.
Upvotes: 7