Understanding the different Android Dimension units

January 25, 2019

One of the most common android questions is; What is the difference between Android units of measure?. Android has four different dimension units: px, dip, dp and sp.

Let's get a better understanding of these by looking at the Android Developer Documentation

px - (pixels) The amount of pixels on the screen. Not often used since screens have different pixel densities. 
in - (inches) The physical size of the screen. Not often used since different screen sizes have different resolutions. 1 Inch = 2.54 centimeters
mm - (millimeters) The physical size of the screen, similar to how inches work. 
pt - 1/72 of an inch (2.54cm) based on the physical size of the screen.
dp or dip - (Density-independent Pixels) an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. This is commonly most used when setting the layouts or any sizes on an Android application. 
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. Typically used when setting font sizes inside an Android Application.