Android: Layout Unit conversions

Source: Internet
Author: User

One, px

Pixel pixels | Not resolved

Second, DPI

dpi (dots perinch): dots per inch, that is, screen diagonal pixel value ÷ inch value

For example, 480x800 resolution 4.0-inch mobile phone computing dpi=

Third, DP

DP (same as DIP): 1DP = 1px on a monitor 160 dots per inch, px = DP (dpi/160)

Suppose two screen size, the screen one DPI value is twice times the right, if the screen a DPI of 160, the screen two DPI is 320, set 160DP case

Screen One: 160PX=160DP (160dpi/160) Screen II: 320PX=160DP (320dpi/160)

Depending on the relationship, it can be concluded that:

Screen a control length of 160px, screen two control length of 320px, so that the length of the control to adapt to different screen size, with DP very suitable.

Four, SP

SP (scaled pixels) is typically used to specify the font size, and the SP changes when the user modifies the phone display font

More:

Http://www.cnblogs.com/cmduan/archive/2012/03/09/2388345.html

Android: Layout Unit conversions

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.