Reputation: 99
I want to know if there was good way to keep my application from rotating, but let it go switch from landscape to landscape reversed?
I've only found this:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
How can I restrict my applications to those two states?
Upvotes: 1
Views: 98
Reputation: 998
Don't wanna say it but RTM
!
Here, in your Manifest
add this to your activity you wanna let rotate :
android:screenOrientation="sensorLandscape"
Upvotes: 3
Reputation: 2769
Just add the following line to activities added in Manifests
<activity android:name=".youractivityName" android:screenOrientation="portrait" />
Upvotes: 0
Reputation: 7911
You just need to do one thing, just put android:screenOrientation="landscape"
in every <activity>
tag of your manifest
file
Upvotes: 0
Reputation: 151
have a look here (duplicate)
Force an Android activity to always use landscape mode
You have to define this in the manifest
Upvotes: 0
Reputation: 1176
Try adding this to your <activity>
tag in the AndroidManifest.xml
android:screenOrientation="sensorLandscape"
Or if you want to do it programmatically you can add this to your activity
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}
Upvotes: 0