Reputation: 2150
I know this :
android:screenOrientation="landscape"
But depending on which orientation you open the app, the way changes (even if it's landscape, there're 2 ways).
How can I force an app to open one way?
For clarity sake, I really want the volume button at the bottom of the tablet only.
Though I know it changes depending on which constructor I'm building my app for a single device, so I wonder if that is possible.
Upvotes: 2
Views: 2713
Reputation: 53
You can also add to manifest file this option: android:screenOrientation="portrait"
or
android:screenOrientation="landscape"
Upvotes: 0
Reputation: 2512
You can just lock the landscape orientation this way :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Or if you want the reversed landscape orientation :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
Upvotes: 2
Reputation: 709
I believe you can find what you need here: activity | Android Developer #android:screenOrientation
There are more options than landscape and portrait, I believe the ones helpful to you would be "reverseLandscape" and "sensorLandscape". Since the volume button differs from tablet to tablet, you may want to use "sensorLandscape" and ask the user turn their tablet to such orientation, just a suggestion.
Edit: Just saw you said you are building for one device, I guess "reverseLandscape" will do just fine.
Upvotes: 1
Reputation: 21
Don't forget to put in the manifest file where the activity is defined!!! Best regards
Upvotes: 1
Reputation: 5363
Try with this in onCreate()
method of Activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Upvotes: 3