Android densities and screen dimensions cheat sheet

UNITS

Abstract units:

dp = Density-independent Pixels – An abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi/ppi (dots per inch) screen, on which 1dp is roughly equal to 1px (1dp = 1px on a 160 ppi screen). When running on a higher density screen, the number of pixels used to draw 1dp is scaled up by the OS by a factor appropriate for the screen’s dpi.

The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Using dp units (instead of px units) is a simple solution to making the view dimensions in your layout resize properly for different screen densities. In other words, it provides consistency for the real-world sizes of your UI elements across different devices.

sp = Scale-independent Pixels, and it’s for fonts. This is like the dp unit, but it is also scaled by the user’s font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user’s preference.

 

Physical units:

pt = a Point – a physical (real life) measurement. 1 pt = 1/72 of an inch.

mm / in = milimeteres / inches.  a physical (real life) measurement.

 

Actual screen units:

px = Pixels – Corresponds to actual pixels on the screen

 

 

RATIOS AND DIMENSIONS

Android dpi calculator: http://coh.io/adpi/

mdpi = @1x = your standard 320×480 screen (eg iPhone 3), which based on a 3.5″ physical screen size works out to roughly 160 ppi. Mdpi is the baseline for a dp (dp being an abstract, scaleable unit based on a screen density of around 160 ppi).

hdpi = @1.5x

xhdpi = @2x

xxhdpi = @3x

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s