[align=center]How to scale Droid emulator to correct physical size
This snippet assumes you have already created your AVD
as a Droid AVD
either via the Android SDK and AVD Manager
, or the command line with something like the following:
[font=Courier New]>android create AVD -n MyDroidAVD -t 4 --skin WVGA854[/font]
option is system specific. In my case -t 4
means to use the Android 2.0
platform; yours might be different depending on how many platforms you have installed. You should check this with:
[font=Courier New]>android list targets[/font]
and use the -t
value appropriate for your purposes. Note use of the WVGA854 skin
This is what we want (full size):
To get the emulator's display screen (as it appears on your monitor) to be the same form factor as the Droid handset
, do the following:
Get your monitor dpi (from the manufacturer spec, or just measure it – it'll be close enough).
Calculate the scaled dpi
From this link
(about 3/4 of the way down), we see that the default setup for the WVGA854 skin
is 4.1 inches
(diagonal), but the Droid handset
is only 3.7 inches
(diagonal). We need to scale the monitor dpi (from step 1) to take this difference into account. As an example, say your monitor dpi is 100 (mine is exactly 100, but 96 and 98 are typical values), we'd get:
100dpi * (3.7in/4.1in) = 90dpi
Enter the scaled dpi
value as an emulator option
Assume we calculated a scaled dpi
of 90 in step 2.
users: Run->Run Configurations..., Target tab, under Emulator Launch Parameters add:
[font=Courier New]-scale 90dpi[/font]
to the Command Line Options textbox. You may have to adjust the size of the dialog box to see the textbox; it's at the very bottom:
users: Add '-scale 90dpi' to the end of your normal emulator command line:
[font=Courier New]>emulator <your usual options> -scale 90dpi[/font]
(Do not leave a space between the number and the 'dpi' suffix).
There is much more information on scaling and screen independence here
. In particular, see Table 1
(screens supported) and How to Test Your Application on Multiple Screens
One small caveat: remember that there is no way to make more pixels on your development monitor. The Droid handset
has 854 pixels crammed into the same space represented on your monitor by only about a third of that number, so the image quality on your monitor is going to be pretty poor. However, the size will be exactly correct for what you'd see on the Droid handset
, which makes it perfect for testing UI form factor and human interface features.
Hint of the Day: Use Alt-Enter to toggle full screen display of your emulator.
Hope this helps!