Density-independent pixels are a virtual pixel element that you should use when defining a user interface layout to express the size or position of the layout regardless of density.
A density-independent pixel is equivalent to one physical pixel on a screen with a resolution of 160 dpi, which is the base density accepted by the system for a medium-density screen. During operation, the system transparently processes any scaling of dp blocks as necessary, based on the actual density of the screen used. Converting dp blocks to screen pixels is simple:
px = dp * (dpi / 160)
For example, on a screen with a resolution of 240 dpi, 1 dp is equal to 1.5 physical pixels. You should always use dp modules when defining the user interface of an application to ensure that your interface displays correctly on screens with different densities.
For a screen with a resolution of 160 dpi, 1 dp is 1 px.
Refer to this blog and this answer.
Jaguar
source share