Differences between Android px, dp, pt, and sp

Source: Internet
Author: User

Differences between Android px, dp, pt, and sp

Android, such as px (pixel) mm, is not recommended.

Why can I use web development on a computer instead of Android?

Because px indicates the number of pixels, the resolution is usually the same on the computer.

Both 14-inch and 15-inch versions are 1366*768, and the resolution of mobile phones is generally different.

Googe solution:

Dp (dip) (calculated by Pixel based on screen density)

For mobile phones of the same screen size, the density (resolution) varies. When px is used, the view with different sizes is displayed. The component with the same dp length is used, and the final display size is the same.

Suggestion:

Dp (dip) indicates the width and height of the control.

Sp text size

Resolution problems:

Example: 320*480 (5-inch)

Representative: There are 320 pixels in the horizontal direction

The portrait has 480 pixels

480*800 (5 inches)

The screen size is as big as pixels, and the point density is high.

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.