简体   繁体   English

如何使用自定义DPI /分辨率/尺寸定义设备?

[英]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. 例如,当我尝试创建具有5“和1744x981像素(等于400 ppi)的设备时,在运行时我得到4.6”,1920x1080和480 ppi(这是最近的密度桶)。

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. hw.lcd.heighthw.lcd.width的正确值为1744x981,但hw.lcd.density已设置为480。在运行时将其更改回400可以将屏幕放大5.5“,同时将分辨率保持为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: 在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. 这适用于Linux AVD Emulator和CLI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM