I am running android emulator 26.1.3 on my laptop with KDE Neon installed. KDE Neon is distribution based on Ubuntu 16.04 with latest KDE. The screen resolution of my laptop is 14" 3840X2160. Physical DPI == 315. In KDE 'system settings'- > 'fonts' --> 'force font DPI' set to 196.
I launched a Nexus_5X_API_26 emulator instance in ADV manager. The device profile:
hw.lcd.width = 1080
hw.lcd.height = 1920
hw.lcd.depth = 16
hw.lcd.density = 420
The emulator display like this. How to correct this?
Alt+Enter is the keyboard shortcut to toggle full screen mode in the emulator, just do it again to exit full screen.
Short version:
1. Find your scaling factor in Displays -> Scale Display
2. Divide 1
by that scaling factor.
For example, if you have the scaling factor set to 2.0
, then the result will be 0.5
.
3. In your studio.sh
, add somewhere after the first line, this export:export QT_SCALE_FACTOR=[calculated scale factor reduction]
In our example, [calculated scale factor reduction]
will be 0.5
, so: export QT_SCALE_FACTOR=0.5
.
4. Done
Additional info:
This is somewhat a KDE scaling issue.
One solution is to change the scaling back to "x1.0" but this will affect all the applications and everything will look small.
Happily, the emulator is a Qt application, thus you can change the scaling through the environment variable, without affecting the rest of the IDE or Desktop UI.
For anybody running from modern Android Studio (or IDEA Ultimate), you should go to the location of your android sdk e.g. /home/<user>/Android/Sdk/emulator/
and run the following from within that directory:
# Enter your calculated scale factor e.g. 0.45 here, if your KDE scale factor is e.g. 2.2, 1/2.2 =~ 0.45
read scale_factor
mv emulator emulator.base
echo -E "#!/bin/env bash\nQT_SCALE_FACTOR=${scale_factor} $(pwd)/emulator.base $*" > $(pwd)/emulator
chmod +x $(pwd)/emulator
Credits to Lilian for their original answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With