screen densities
Description
Android defines and recognizes four screen densities:
- Low density (ldpi) - 120 dpi
- Medium density (mdpi) - 160 dpi
- High density (hdpi) - 240 dpi
- Extra High density (xhdpi) - 320 dpi
Example
The screen of the Nexus S has a 4-inch screen diagonally, with a screen width of 2.04 inches.
Its resolution is 480 (width) 800 (height) pixels. With 480 pixels spread across a width of 2.04 inches, the result is a pixel density of about 235 dots per inch (dpi).
The Nexus S is regarded as a hdpi device, as its pixel density is closest to 240 dpi.
Note
Using the dp unit ensures that your views are always displayed in the right proportion regardless of the screen density.