Jimbo
Jimbo

Reputation: 39

Android, landscape only view orientation - Phone and Tablet

I'm trying to create an android app with a fixed landscape orientation so I updated the manifest to include the following

activity android:name=".MainActivity" android:screenOrientation="sensorLandscape"

This worked perfectly on a Pixel 2 phone, but when I opened the app on a Nexus 9 Tablet the orientation matched the rotation of the device as if I had done nothing.

Why is this happening and what can I do to resolve the issue?

I'm fairly novice, so please keep things simple.

cheers

Upvotes: 2

Views: 68

Answers (1)

Try adding

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

to your OnCreate method and see what happens

Upvotes: 0

Related Questions