1. Terminology and concepts
|
Terms |
Description |
Note |
| Screen size |
Refers to the actual physical size of the phone, such as the usual 2.8-inch, 3.2-inch, 3.5-inch, 3.7-inch |
Motorola milestone phone is 3.7 inches |
| Aspect Ratio (width/height ratio) |
Refers to the actual physical dimensions of the width-to-height ratio, divided into long and nolong |
Milestone is 16:9, belongs to Long |
| Resolution (resolution) |
The same as the computer resolution concept, refers to the phone screen vertical, horizontal direction of the number of pixels |
Milestone is 854*480. |
| DPI (dot per inch) |
Pixels per inch, such as 120dpi,160dpi, assume that the screen physical size of the QVGA (320*240) Resolution is (2 inches * 1.5 inches), dpi=160 |
Can reflect the sharpness of the screen, which is used to scale the UI |
| Density (PPI density) |
The pixel concentration in the screen, Resolution/screen size can reflect the cell phone density
Calculation formula: Pixel density =√{(length pixels ^2+ width Prime number ^2)}/screen size |
|
| Density-independent Pixel (DIP) |
Refers to the logical density unit, the corresponding formula for dip and specific pixel values is dip/pixel=dpi value/160, which is px = DP * (dpi/160) |
|
2. Unit conversions
getresources (). Getdimensionpixeloffset (r.dimen.activity_vertical_margin1);
Gets the value of a dimen, if it is a DP or SP unit, multiplies it by density, and if it is PX, returns the float
Gets the value of a dimen, if it is a DP or SP unit, multiplies it by density and, if it is PX, returns an int
Whether the DP or SP or PX is written, it is multiplied by denstiy.
Android Screen Related concepts (1)