简体   繁体   中英

Android always in portrait mode not working

I want to run my application always in portrait mode. I searched and found the code below, then I added to manifest file.

android:configChanges="orientation"
android:screenOrientation="portrait"

but my application still chancing orientation when I press CRTL+F12 on AVD. How can I force my application always run in portrait mode?

Ps: I tried the code reverse. (Second line first then first line)

Did you add that in the activity element, not the application element?

 <activity 
    android:screenOrientation="portrait"  
    android:configChanges="orientation|keyboardHidden" >
 </activity>

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