简体   繁体   中英

Rotate screen without turn on auto-rotate

I'm making a small streaming TV application for Android.

I want to set the video-view to fullscreen when the user rotates its device. But it was only allowed when Auto-rotate button was enabled.

How to make the app rotate the screen without turning on the auto-rotate button? I noticed that there are many apps and games that can do that, like Clash Of Clan.

Inside your AndroidManifest add this attribute to your Activity : android:screenOrientation="landscape"

else add this code into onCreate Method : this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); it will make it rotate as soon as it run hope that helps you

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