Pixel Ruler Rule your Android and iOS design.

Density-independent pixel

Density-independent pixel (dp, dip) is an Android mechanism which provides compatibility with any possible display density. When you define the size in dp, it doesn't matter what the display resolution is, the size doesn't change.

In real world 1dp is aproximatelly 0.2 mm. If it is not, it is manufacturer's purpose. By this you can say "this image should be 2x2cm in size" and it really happens, no matter if the user has a tablet with low resolution or a Full HD phone.

When to use Density-independent pixels?

First of all, you should avoid defining sizes in plain pixels. There are only few use cases, when you have to use pixels. You should decide for one of this values:

First two are useful for defining the relative size according to it's parent or its descendants. Scale-independent pixels (sp) suitable are for text size. Density-independent pixels should be used whenever you need to define the exact size of the object.

How it varies across densities?

Density independent pixel is defined as one psychycal pixel on the display with 160 DPI (mdpi).

Density 1dp equals Device examples
120 DPI ldpi 0.75 px HTC Desire
160 DPI mdpi 1 px T-Mobile G1, HTC Legend
213 DPI tvdpi 1.33 px Nexus 7
240 DPI hdpi 1.5 px Google Nexus One, HTC Desire
320 DPI xhdpi 2 px Galaxy Nexus, Samsung Galaxy S3
480 DPI xxhdpi 3 px Google Nexus 5, Samsung Galaxy S5
640 DPI xxxhdpi 4 px
Measuring pixels in Android browser
Pixel Ruler home
Swipe to dock feature
Where to measure
Triple click zoom Android
Pixel Ruler in Google Play

Follow us on Google+