UI interface Control Size conversion

Source: Internet
Author: User

A basic concept

1. DPI (dots per inch) of how many dots each, and PPI (Pixel per inch), pixel pixels. For the design of the display, Dpi=ppi.

2. Dip (device independent pixels) devices independent pixels, different devices have different display effect, this is related to the device hardware, do not rely on pixels.

3. DP (density-independent pixel), an abstract unit based on screen density. 1DP = 1px on a monitor 160 dots per inch.

4. PX (pixels) pixels are the actual pixel units on the screen.

5. SP (scale-independent pixels), it is the font unit of Android, the 160PPI screen as standard, when the font size is 100%, 1sp=1px.

Two calculation methods and conversion

dpi=√ (length pixels ²+ width pixels ²)/Screen diagonal inches

Conversion formulas for DP and PX:

dp*ppi/160 = px. such as 1DP x 320ppi/160 = 2px.

Conversion formula for SP and PX:

sp*ppi/160 = px

Http://www.cnblogs.com/halbertsun/p/4901724.html

UI interface Control Size conversion

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.