Measurement unit in Android

Source: Internet
Author: User

Here are the units of measurement supportedAndroid:

(1) Px --> pixels-corresponds to actual pixels on the screen.

(2) In --> inches-based on the physical size of the screen.

(3) Mm --> millimeters-based on the physical size of the screen.

(4) Pt --> points-1/72 of an inch based on the physical size of the screen.

(5) DP --> density-independent pixels-an abstract unit that is based on the physical density of the screen. these units are relative to a 160 DPI screen, so one DP is one pixel on a 160 DPI screen. the ratio of DP-to-pixel will change with the screen density, but not necessarily in direct proportion. note: The Compiler accepts both "dip" and "DP", though "DP" is more consistent with "SP ".

(6) sp --> Scale-independent pixels-this is like the DP unit, but it is also scaled by the user's font size preference. it is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

 

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.