/** * Crazyandcoder * Contact: * QQ : 275137657 * Email: [Email protected] * Reprint please indicate the source! */
Android Screen resolution summary
Contact Androidui Design always encounter some concepts such as: dpi, PPI, SP, DP, etc., what do these mean? And what do we need to be aware of when we use these? Next we will make a summary, convenient for later use.
First, the basic concept
pixel pixels, The actual pixel point units in the screen, such as 50px, 100px, and so on. When we zoom in on a picture, we find that the image is made up of small squares, each of which is a pixel.
device independent pixels (Devicesindependent pixels)
We often hear 320*480, 1920*1080 and so on, which is the resolution, that is, the screen and the height of the number of pixels.
screen pixel density (dot per inch), print resolution, that is, the number of points per inch can be printed, that is, printing accuracy.
image resolution (pixels per inch), in the image, the number of pixels per inch. DPI is mainly used for output, the focus is on the printing device, PPI for designers should be more familiar with the Photoshop canvas resolution is usually set to 72 pixels per inch, this unit is actually PPI, although the concept is different, but for mobile devices to display, can be regarded as ppi=dpi. operation mode: ppi=√ (length pixel 2)/diagonal inch of screen. That is: the length and width of each square sum of the root, and then divided by the number of inches diagonal. for IPhone5: its ppi=√ (1136px2 + 640px2)/4 In=326ppi (Retinal retina screen) for Android phones: An inaccurate division is that 720 x 1280 mobile phone is likely to be close to the XHDPI mode, 480 x 800 mobile phone is likely to be close to the DPI (hdpi mode), and the x 480 Mobile phone is close to the DPI (MDPI mode).
enlarge pixels, scaled pixels, mainly in the font display.
second, conversion relationship
Android Development, the text size of the unit is the SP, other non-text size units are DP, but we are designed to use the unit is generally pixel px, how these units are converted, for Android developers, designers are necessary to understand. px=dp*ppi/160px=sp*ppi/1601) dp:density-indenpendent pixels, with 160PPI screen as standard, then 1dp=1px. For 320PPI screen, then 1dp*320ppi/160=2px;2) sp:scale-independent pixels, which is the Android font unit, to 160PPI screen as standard, if the font size is 100%, 1sp=1px, for 320PPI screen, 1sp*320ppi/160=2p X. To put it simply, PX is the unit that the UI designer uses in PS, and it is also shown on the phone screen, and DP is the size unit used when developing the unload layout.
Why use SP, DP instead of PX?
Because they do not change as the PPI changes, they present the same level of height under the same physical size and different PPI, which is closer to physical rendering, and PX is not.
when running in mdpi mode, 1dp=1px.
In other words: If the designer labels the item height at 48px in the PS design, then the item height defined in layout is 48DP. when running in hdpi mode, 1dp=1.5px. In other words: If the designer labels the item height at 72px in the PS design, then the item height defined in layout is 48DP.
When running in xhdpi mode, 1dp=2px. In other words: If the designer labels the item height at 96px in the PS design, then the item height defined in layout is 48DP.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Screen resolution summary