I'm mainly using the Android emulator for development. Is there a quick way (ideally a keyboard shortcut) to switch between dark mode and light mode for testing the dark/light themes?
Asked
Active
Viewed 1,458 times
5
-
I am hoping for a solution similar to the one for this question: https://stackoverflow.com/questions/59886562/is-there-a-keyboard-shortcut-to-switch-between-dark-mode-and-light-mode-in-iphon – don Aug 05 '21 at 20:51
-
Not on the emulator but on the layout editor you can just press `N` – javdromero Aug 05 '21 at 20:53
-
2You should be able to add the dark mode tile in the notification shade, as you do with an actual device. – CommonsWare Aug 05 '21 at 21:10
2 Answers
5
Just to bring more visibility to the comment above with a great solution:
You should be able to add the dark mode tile in the [swipe down] notification shade, as you do with an actual device.
Obviously it will change slightly depending on the phone you are emulating but here is a demo for anyone not used to Android devices

australis
- 431
- 5
- 10
2
If you use MacOS, you can automate this action with a shortcut:
- Open Shortcuts.app
- Find action "Run shell script"
- Insert this script:
alias adb="/Users/YOUR_USERNAME/Library/Android/sdk/platform-tools/adb"
if [[ $(adb shell "cmd uimode night") == "Night mode: yes" ]]; then
adb shell "cmd uimode night no"
else
adb shell "cmd uimode night yes"
fi
- Select "Shortcut details" tab on the top right ("i" icon), click Add keyboard shortcut and add your shortcut.
Here is an example:
Works perfectly!

pavelperc
- 119
- 5