Allow only 2 screen orientations in Android?

To lock the application to run in only 1 screen orientation, we could do this in AndroidManifest.xml:

<activity
        android:name="..."
        android:screenOrientation="portrait"/>

The problem is that I just found out that I need to make the application also rotary for reversePortrait, the first thing I tried was:

<activity
        android:name="..."
        android:screenOrientation="portrait|reversePortrait"/>

But it seems to android:screenOrientationallow only one meaning. How else could we achieve this?

+4
source share
1 answer

What would you like:

<activity
        android:name="..."
        android:screenOrientation="sensorPortrait"/>

see here .

+4
source

Source: https://habr.com/ru/post/1628273/


All Articles