Screen size related

Source: Internet
Author: User

PX (pixel) pixels, that is, the display point on the screen, in (inch) inch, per inch = 2.54 cm, we often say that a few inches of mobile phones, refers to the phone screen diagonal is a few inch, dpi (dots per inch) the number of pixels, 320x480 screen, If the width is 1 inches, the horizontal dpi is 320/1 (wide), and if the height is 1.5, the vertical dpi is 480/1.5 (high), so both landscape and portrait are 320, because the phone screen mostly uses square dots; density screen density, using density = DPI/ The larger the 160;dpi, the greater the density; DP (Dip,device independent pixels) is an Android-specific unit with a screen density of dpi=160 on the screen, 1DP = 1px; if dpi=320, then 1DP = 2px; SP is the same as DP, mainly used for font size, and DP is different from the size of the font can be scaled, for the picture resource first, the screen size, the following is a few common screen size
    • DRAWABLE-LDPI (dpi=120, density=0.75)
    • DRAWABLE-MDPI (dpi=160, Density=1)
    • DRAWABLE-HDPI (dpi=240, density=1.5)
    • DRAWABLE-XHDPI (dpi=320, density=2)
    • DRAWABLE-XXHDPI (dpi=480, density=3)
Sometimes we can be based on the screen size to match the different pictures, but this will increase the size of the apk, and sometimes trouble; Android will automatically render, according to the screen size automatically select files to render, according to the above path priority to find the corresponding folder under the picture to draw; xhdpi as a resource choice, Because most of the current mobile phone is this size; image display and wrap_content; First, we have a 120x120px image in the xhdpi directory, so the size shown on the hdpi screen is 120PX/2 (xhdpi screen density) * 1.5 (hdpi screen density) = 90px, and so on; Of course, if there is already a 120x120 picture in the drawable-mdpi directory, then the picture will be displayed as 120x120;

Screen size related

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.