How to rotate the screen in the Android emulator
Codemia Knowledge Hub ·
Click the rotate-left or rotate-right button on the emulator toolbar. For scripted tests, turn off accelerometer_rotation and set the orientation with adb shell settings put system user_rotation. If the device rotates but the screen does not, the cause is usually Android's rotation lock or the app's own configuration, not the emulator.
Rotating with the emulator controls
In the running emulator window, the rotate buttons on the toolbar simulate turning the device, the same as rotating a physical phone.
For keyboard shortcuts, open the emulator help pane to see the mappings for your setup. They can differ depending on whether the emulator runs embedded in Android Studio or in a separate window, so do not rely on old shortcut assumptions.
These controls only simulate turning the device. They do not override your activity's manifest settings.
Checking that auto-rotate is not locked
If the emulator rotates but the contents do not, auto-rotate may be disabled. Open quick settings inside the emulator and make sure rotation lock is off.
For scripted testing, adb can set the system setting directly:
In many builds, user_rotation values map like this:
0for portrait1for landscape2for reverse portrait3for reverse landscape
To restore sensor-based rotation:
This gives tests a predictable orientation without manual clicking.
When the app blocks rotation
An app can opt out of normal rotation. For example, an activity can be pinned to portrait in the manifest:
With that attribute, the emulator rotates but the activity stays portrait. Apps that handle configuration changes manually may also not recreate the activity the way you expect.
To see the normal recreation flow, leave the system in control and log the lifecycle callbacks:
Rotating the emulator should trigger a configuration change unless you deliberately overrode that behavior.
Testing orientation beyond phone rotation
To check layout adaptation, the toolbar is enough. For deterministic automated tests, use adb or instrumented tests that change orientation explicitly.
Tablets, foldables, and resizable emulator devices expose layout bugs that a simple portrait-to-landscape switch misses. This is especially true for adaptive layouts: a screen can pass a basic rotation test and still fail when width classes or multi-window constraints change.
Related reading
- How do I change the android actionbar title and icon
- How do I change the background color of a SwiftUI View?
- How do I change the background color of the ActionBar of an ActionBarActivity using XML?
- How do I change the color of the text in a UIPickerView under iOS 7?
- How do I change the font size of a UILabel in Swift?
- How do I change the title of the back button on a Navigation Bar
- How do I check if a string contains another string in Objective-C?
- How do I check if a string contains another string in Swift?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.