How do I get 1:1 pixels on the Android simulator?

I created an AVD without screen scaling, but the pixels don't match my screen

Is there any work here?

The screen configuration is 720 wide, but it is 413 on my screen

Editor: more experiences, answered by @ fallonreaper:

If I load a 500px wide image in the browser, it is still larger than the screen (it should be 720px wide)

This is a 500px image. There are two screenshots. Scroll to the right. It is larger than the 720px screen

Edit 2: this may be related to this http://www.quirksmode.org/blog/archives/2010/04/a_ pixel_ is_ Not.html

resolvent:

When starting the simulator from the Android virtual device manager, you must check that the "zoom" is displayed as the actual size, and then specify the "screen size" (in) and the "monitor" DPI, which are calculated as the "zoom" value of 1.0 (0.50 if you are on a retinal display) on OSX

In my example, I specified a 4.7-inch screen size and a 160 monitor DPI, which produced a 0.50 scale. When I took a screenshot of my simulator, it is now pixel to pixel, and I want to see it on the device

When starting the simulator from the command line, you can also specify the command line option - scale 1.0

If your simulator is already running, you can adjust the ratio of the emulator console by sending the window ratio of 1.0. This is too large for me to use on my retina MBP

Use the ADB device to discover the running simulator. You should see the following output:

$adb devices
List of devices attached 
emulator-5554   device

You can then connect to the device and send the scale command:

$telnet localhost 5554
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
window scale .50
OK
^]
telnet> quit
Connection closed.

You can do this in a script using netcat:

$echo 'window scale 0.50' | nc localhost 5554

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>