Difference and conversion formula of PX and dip

Source: Internet
Author: User

What is the difference between PX and dip?

Dip! = Px

It is mainly for different devices. On a device whose density is 160, for example, the default simulator created with avdmanager, dip and PX are the same, but if the sameCodeSwitch to a device with different density, for example, to a device with a density of 240, the size of dip and PX is different. PX is as long as it is on any device,DipBased on device changes; wqvga screen density = 120; qvga screen density = 120; hvga screen density = 160; WVGA screen density = 240; density value indicates the number of display points per inch, resolution and resolution are two concepts.

Resources that use the hdpi label when the screen density is 240
Resources that use the mdpi label when the screen density is 160
Ldpi tag resources are used when the screen density is 120.

Resources without any tags are shared in various resolutions. When layout, use the unit dip as much as possible, and use less PX.

Conversion formula:
Pixs = dips * (densitydpi/160 ).

DIPS = (pixs * 160)/densitydpi

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.