Reference: http://www.cnblogs.com/greatverve/archive/2011/12/28/android-dip-dp-sp-pt-px.html
Http://www.360doc.com/content/15/0713/09/26211242_484580697.shtml
Article content for reference only
Dpi==>device independent pixels (device independent pixels), different devices have different display effect, this and equipment hardware;
Generally in order to support WVGA, HVGA and QVGA recommend this, do not rely on pixels;
DPI, which can also be understood as pixels per inch-represents the density of screen pixels, in DPI;
To illustrate:
That is, density-independent pixels, with 160dpi as the benchmark, 1dip=1px
Example:
Device 1: Resolution is 480*320, pixel density is 160dpi
Device 2: Resolution is 800*480, pixel density is 240dpi
Device 1, 1dip=1px, device 2 1dip=240/160px
Dp==> equivalent to DPI
Sp==>scale_independent pixels, can be based on the text size preference for scaling, Google recommended to use more than 12SP units, otherwise it may make users see unclear;
It is recommended to use 12SP,14SP,18SP,22SP, try not to use odd and decimal, because the shrinkage can cause the loss of precision.
Xp==> the smallest unit of the image, pixels (pixels). Different devices show the same effect, generally we hvga represent 320x480 pixels, this use more;
Pt==> Point, is a standard length unit, 1pt=1/72 inches, for printing, very simple to use;
sp:scaled pixels (enlarge pixels). Mainly used for font display best for TEXTSIZE
In (inches) ==> length units;
MM (mm) ==> length unit;
Resolution ==> refers to the total screen is how many points, eg:800*480, it is for the software to display units, in PX units of points, density (density) value indicates how many display points per inch, and the resolution is two concepts.
When the screen is density=240-the resource using the hdpi tag;
When the screen is density=160-the resource using the MDPI tag;
When the screen is density=120-the resource using the ldpi tag;
Note: Android generally sets the length, width--using DPI to do units,--at a screen density of 160, 1pd=1px=1dpi, 1pt=160/72 inches, when the screen is 240, 1dp=1dpi=1.5px
Set font size-use SP;
Android Learning notes 18--dpi, DP, SP, XP ...