Distance unit and internal and external margins, distance unit margin

Source: Internet
Author: User

Distance unit and internal and external margins, distance unit margin

Commonly used Distance Units in android development include px, dp, and sp.

Px is a pixel. For example, on a 480*800 resolution display screen, there are 480 small grids on the horizontal bar, and 800 small grids on the vertical bar. Each grid represents a pixel. The higher the Resolution, the more pixels, the more content displayed.

The screen size is the same, but the resolution may be different, so dpi may be different, and the level of detail will be different.

Dp = dip (Device Independent pixels)

Px = dp * (dpi/160)

On a screen with dpi 160: 1dp = 1px

Sp: scaled pixels, which is usually used to specify the font size. When a user modifies the font displayed on the mobile phone, the sp changes accordingly.

 

The padding and padding are used to control the display style of the control.

Set the padding and padding

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.