The relationship between DP, DPI and PX in Android

Source: Internet
Author: User

Turn to the user's answer:

1. DPI is the dot per inch, how many dots, PPI is Pixel per inch, pixels per inch, for the design of the display, Dpi=ppi.
The PPI calculation method is the sum of the length and width of each square, divided by the diagonal length (in inches). Principle can draw a rectangle of the Pythagorean theorem to calculate a calculation.
2. PPI indicates the point density of the display device, and DPI indicates the print point density.
3. Dip or DP, which is an Android development unit, 1DP indicates 1px length at a screen point density of 160ppi.
Since the Android device screen is numerous and cannot be developed individually for each screen, the number of pixels on different screens is calculated using the formula px=dp* (ppi/160).
Example: HVGA screen 320*480, generally 3.5 inch, calculate the point density is √ (320^2 + 480^2)/3.5 = 164, approximately equal to 160,1pd=1px
WVGA screen 480*800, press 3.8 inch screen count, point density Yes (480^2 + 800^2)/3.8 = 245, approximately equals 240,1dp=1.5px.
There is a higher resolution of the screen is not listed, in short, DP is to facilitate the adaptation of different screen units, at different screen densities, the physical length of the 1DP is the same.

User-aware
Links: https://www.zhihu.com/question/21220154/answer/18584739
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

The relationship between DP, DPI and PX in Android

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.