Why does Lint show a warning when used in (inches) or mm (millimeter) units as a measurement?

The documentation clearly says that mmthey independ on the size of the screen.

mm
Millimeters - Based on the physical size of the screen.

in
Inches - based on the physical size of the screen.

But when I use them, Lint says:

Avoid using "mm" as units (this does not work exactly on all devices); use "dp" instead

Incorrect documentation? And why doesn't Lint warn when using it pt?

pt
Dots - 1/72 of an inch depending on the physical size of the screen.

+4
1

, , DPI Android, .

TL; DR: , Lint . (?) , mm, in pt .

DPI Android

Android , DisplayMetrics:

  • densityDpi - , . , Android (, Medium/160, High/240, Extra High/320).
  • xdpi/ydpi - X/Y. Dpi , .

dp Dpi, mm, in pt xdpi/ydpi .

, Dpi xdpi/ydpi:

  • Dpi , xdpi/ydpi.
  • Dpi , xdpi/ydpi
  • Dpi , xdpi/ydpi
  • xdpi/ydpi .

1 ( Dpi , xdpi/ydpi)

: Samsung Galaxy Trend, Nexus 4, Nexus 7.

, in, mm dp. 1 in 160 dp, , 1 .

2 3 ( Dpi xdpi/ydpi)

2: HTC One S, Sony Xperia V, Sony Xperia Z Ultra.
3: Samsung Galaxy S4, Sony Xperia Z1, Nexus 5.

Dpi xdpi/ydpi , Dpi ​​ . , dpi , , DPI. 1 .

, 1 in 160 dp, . 2 160 dp , 3 . , , 1 in 1 , 160 dp .

Android, , , , , , dp, .

4 ( xdpi/ydpi)

: Samsung Galaxy Mini, Samsung Galaxy S3 Mini.

, Dpi ( dpi ), xdpi/ydpi.

, Samsung Galaxy S3 Mini xdpi 160 Dpi 240. 480 , 160 dpi , 3 , 2,05 . xdpi, , 234.

Samsung Galaxy Mini, xdpi 160, Dpi, 120. 240 , 1,5 , 1,9 ( xdpi 126).

, in, mm, pt, .

1-3

Comparison of category 1-3 devices

, 1, 2 3. 1 xdpi ydpi, 1 , dp (160 dp).

, , .

4

Screenshot from category 4 device

4. , , : 1 in 72 pt. , , , .

, 0,67 .

Lint 4, xdpi ydpi. xdpi/ydpi , (mm, in, pt), .

?

, . (xdpi/ydpi) Android, .

Lint pt?

Lint, , pt, , in mm.

, dp, - , , Android, , - dp , , .

+12

All Articles