简体   繁体   中英

How to set the Portrait and landscape orientation in android manifest file

Portrait mode is working and landscape is not showing.

android:screenOrientation="portrait" // Here i need to show both portrait and landscape.

You can use:

android:screenOrientation="unspecified"

This is the default value and the system chooses the orientation.

alternatively, you can use:

android:screenOrientation="fullSensor"

In this case, device orientation sensor determinates the screen orientation.

Try one and the other to see which one works best for you.

EDIT: For a specific class, you can do this:

<activity
            android:name=".YOUR_CLASS"
            android:screenOrientation="unspecified"  // or what you want
            android:theme="@style/Theme.Design.NoActionBar"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM