Size measurement units (px, DPI, DP, dip, SP) for Android app Development view

Source: Internet
Author: User
Tags benchmark

One, pixel (px) and screen resolution

1)

on the development of the application, the screen resolution is not used.

3) Screen resolution is wide * high, but it is not the size of the screen It is related to the number of pixels in a screen.


II, dpi

1 ) DPI : pixels per inch, is the screen pixel ( px ) The unit of density. Pixel density is the number of pixels that the screen specifies to be displayed within the physical wide range.

2) inAndroidin whichDPIhave the following classifications,ldpi,mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi

3in reality, it is common tomdpias a benchmark, it represents160dpi, and defines this density as1unit of density. 160dpirepresents the1square inches of area have160*160pixel points. ldpiis the120dpi,hdpiis the240dpi,xhdpiis the320dpi,xxhdpiis the480dpi,xxxhdpiis the640dpi, which meansldpithe density is0.75,hdpithe density is for1.5,xhdpiis the2,xxdpiis the3,xxxhdpiis the4.

4 ) DPI regardless of the size of the screen, it is just a measure of the pixel density.


Third, DP

A unit of measure independent of the physical density, which160dpias a benchmark, regardless of theDPIunder the screen,1DPthe physical length of the representation is the same. In the160dpiunder the screen,1DP=1px, which is aDPneed to use apxto indicate that in240dpiunder the screen,1DP=1.5px, which represents aDPneed to1.5apxto express. Which means1DP=DPI/ the*px. It is meant to enable developers to developDPIThe display size is the same under the ShieldUI . that is, in the same size, but different resolution of the phone, with the DP logo, the size of the display is the same.


Four, Dip

with the DP same


V, SP

scaled pixels The abbreviation for the magnified pixel, is specifically designed to handle the size of the font. It is not only related to screen dpi, but also to the system's default font size. For the same SP value, the higher the screen dpi, the smaller the font is displayed; The larger the system font, the larger the font is displayed . That's why all the fonts that use the SP have changed since we set the system font size.


Size measurement units (px, DPI, DP, dip, SP) for Android app Development view

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.