How to get 1: 1 pixels in an Android emulator?

I created an AVD without scaling the screen, but the pixels do not match my screen.

is there any work for this?

enter image description here

The screen has a width of 720, but is displayed on the screen 413.

Edit: a little more experience, motivated by @Fallenreaper's answer:

If I load an image with a width of 500 pixels in the browser, it is still larger than the screen (which should have been 720 pixels wide).

enter image description here

Here is a 500px image with two screenshots, scrolling to the right to show it larger than the 720px screen.

edit 2: this could be due to this http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html

+4
source share
2 answers

When you run the emulator with the Android Virtual Device Manager , you should check the Scale display to real size , and then specify the Screen Size (in) and Monitor dpi , which calculates the Scale value of 1.0 (or 0.50 re on the retina screen on OSX).

In my case, I specified a 4.7 in Screen Size and a 160 Monitor dpi , which gave a 0.50 Scale . When I take a screenshot of my emulator, it is now the pixel-by-pixel that I expect to see on the device.

You can also specify the -scale 1.0 command-line -scale 1.0 when starting the emulator from the command line.

If your emulator is already running, you can adjust the scale using the emulator console by sending window scale 1.0 . It makes too much use for me on my Retina MBP.

Open your running emulators with adb devices . You should see the output as follows:

 $ adb devices List of devices attached emulator-5554 device 

Then you can connect to the device and send the zoom 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. 

And you can do it in a script with netcat:

 $ echo 'window scale 0.50' | nc localhost 5554 
+3
source

each device has a different pixel density, so if you want to adjust it to a 1 to 1 ratio, you will need to determine the pixel density of the device and compare it with your main machine ... then accordingly.

Different pixel densities will cause 1 more than others, so if you are designing a screen, your text fields look right like 30x 150, but on a 30x150 device it will be much smaller.

Source: I make iOS and Android Web App Dev for WebViews, and I ran forward because I do it every day.

0
source

Source: https://habr.com/ru/post/1499861/


All Articles