Abstract: This article introduces the concept of android Unit dp and dip, and gives its exact meaning. Summary in Android, dp is short for Density-independent Pixels, while dip is Density Independent Pixels. It actually refers to a concept, which is a unit of Android. Description in More Resource Types: 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 (dots per inch) screen, on which 1dp is roughly equal to 1px. when running on a higher density screen, the number of pixels used to draw 1dp is scaled up by a factor appropriate for the screen's dpi. likewise, when on a lower density Screen, the number of pixels used for 1dp is scaled down. 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 ac Ross different devices. the Unit px represents pixels. The conversion formula between pixels and ds is also described in Supporting Multiple Screens: Density-independent pixel (dp) A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way. the density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium "Density screen. at runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. the conversion of dp units to screen pixels is simple: px = dp * (dpi/160 ). for example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. you shoshould always use dp units when defining your application's UI, to ensure proper display of you R UI on screens with different densities. The formula [cpp] px = dp * (dpi/160) indicates the number of pixels that 1dp represents. Below we will simply deduce this formula. First, dpi is the abbreviation of Dots Per Inch (wiki), indicating the number of vertices in 1 Inch. For the UI interface, this point is Pixel ). Then, let's take a look at the unit of dp: [plain] pixel = the unit of dp * pixel/inch. We can see that the unit of dp is the unit of length, the last sentence of the above dp definition illustrates this: In other words, it provides consistency for the real-world sizes of your UI elements using SS different devices. finally, let's take a look at the value of 1dp. 1 DP corresponds to dpi/160 pixels. According to dpi definition, the length of each pixel is 1/dpi inch, and the combination is 1 dp = 1/160 inch. [Cpp] 1 dp length = 1 * dpi/160*1/dpi inches = 1/160 inch conclusion dp is equivalent to dip, It is a length unit, 1 dp = 1/160 inch. The unit of dp indicates that you can set the corresponding dp value in the application based on the actual size, which makes the difference between devices look as big as possible.