When I switch to landscape mode (NUMPAD 7 or CTRL+F11) the emulator rotates the screen to landscape orientation but the Android OS and none of the apps rotate. So everything is sitting sideways. Is there something in the AVD configuration that needs to be set in order for the device to rotate properly?
问题:
回答1:
It is a bug with the 2.3 and 4.4 emulators.
http://code.google.com/p/android/issues/detail?id=13189 [v2.3]
https://code.google.com/p/android/issues/detail?id=61671 [v4.4]
回答2:
In my case it was solved by disabling the "Hardware keyboard present" checkbox in the "Edit Android Virtual Device (AVD)" window.
回答3:
In my case the Skin option in AVD settings was the problem. When I selected "No skin", it worked.
回答4:
I had same problem. Try removing the "Keyboard lid support" option in the settings of the hardwere virtual machine. It helped me.
回答5:
Another answer here:
in my case the problem was simply that the auto-rotate setting in the android emulator settings (accessible pulling down the notification bar) was disabled, my bad.
回答6:
As of mid 2015 the issue is still open and logged in the android bug tracker here's the link you can check it out https://code.google.com/p/android/issues/detail?id=61671
None of the above solutions worked for me and i am using Android 4.4.2 emulator. As a work around in your graphical layout you can change the orientation and check it out.
回答7:
Is the accelerometer property of the emulator set to True? please check it. if not, set it to true. it should help. its working fine on mine.
Open AVD Manager -> GoTo 'Device Definitions' tab -> Select an existing AVD -> Clone
回答8:
I got this to work with the latest version of AVD.
Check out the config :
Also, here is the result:
I think wha tmakes it click is the combination of keyboard and Skin. Also, if you create your own device make sure you add a Gyroscope sensor.
回答9:
You have to use Android 5.1.1, aka API 22, aka Android 5.1 LOLLIPOP_MR1. Download Android 5.1.1 (API 22) in your Android SDK Manager and when you create a new Android Virtual Device select that as your OS.
As war_Hero mentioned, this bug was reported to Google. The bug is now fixed as of Mar 23 '15:
https://code.google.com/p/android/issues/detail?id=61671
回答10:
I had the same problem, I instantly fixed it by simply deleting the device from the AVD list and just creating a new one.
回答11:
Only way to get this to work is to use FroYo API AVD
For anyone with this issue, this is how I set up old Froyo AVD to test this scenario:
My Manifest min version is already 8, which is Froyo
< uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
You can see SDK_API_VERSION information here. http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
In the SDK manager Installed the needed version:
http://screencast.com/t/KKZokotI4T
Created a new AVD for the new version.
http://screencast.com/t/W8VN6fOWGW
回答12:
I had to install a new virtual device Nexus on API LEVEL 27 On Api Level 28(PIE) I could not rotate the display.
And it works for me. Regards
回答13:
Force your activities to be the orientation you want and you can bypass this issue, unless you really need to test the actual act of rotation on an emulator.
Just add:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
To your activities' onCreate
method. (Or the non-reverse version if necessary for you.)