简体   繁体   中英

How to define devices with custom DPI/resolution/size?

When creating a device one can specify the display diagonal in inch and the resolution in pixel. When starting the emulator those values aren't applied.

For example when I try to create a device with 5" and 1744x981 pixels (which equals 400 ppi) I get 4.6", 1920x1080 and 480 ppi (which is the closest density bucket) at runtime.

I've checked the config file. hw.lcd.height and hw.lcd.width have the correct value of 1744x981 but hw.lcd.density has been set to 480. Changing it back to 400 scales up the screen 5.5" at runtime while leaving the resolution at 1920x1080.

Why doesn't it honor my settings? Is there a way to configure this? If not, is there another emulator that is capable of this?

Add following into AVD config ~/.android/avd/android44.avd/config.ini:

hw.lcd.density=320

Then run the emulator:

/opt/android/sdk/tools/emulator -avd android44 -skin 2048x1536

This works for Linux AVD Emulator and CLI.

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