In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you what the unit size in android, I believe most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Dip: device independent pixels (device independent pixel). Different devices have different display effects, which is related to the device hardware. Generally, we recommend this to support WVGA, HVGA and QVGA, and do not depend on pixels.
Dp: same as dip.
Px: pixels (pixel), a pixel is usually regarded as the smallest complete sample of an image, and the display effect is the same for different devices. Generally, HVGA represents 320x480 pixels, which is used more often.
Pt: point, is a standard unit of length, 1pt=1/72 inches, used in the printing industry, very easy to use.
Sp: scaled pixels (magnified pixels). Mainly used for font display best for textsize.
In: (inch): a unit of length.
Resolution: it is divided into display resolution (screen resolution) and image resolution.
Display resolution: the precision of the screen image refers to the number of pixels that the monitor can display. The more pixels the monitor can display, the finer the picture will be. When the display resolution is fixed, the smaller the display screen is, the clearer the image is. On the contrary, when the display screen size is fixed, the higher the display resolution is, the clearer the image is.
Image resolution: the number of pixels contained in an inch.
The relationship between mdpi and hdpi is 2:3
The relationship between mdpi and xhdpi is 1:2
The relationship between ldpi and mdpi is 3:4
Conversion formula between dp and px:
Pixs = dips * (densityDpi/160).
Dips= (pixs*160) / densityDpi
Now suppose, in a project, you put a picture of 60px*60px in mdpi, and its size is 60 to 60.
If you take it to hdpi, then its size should be 40 to 40, the picture should be reduced.
1. Screen knowledge in Android
Pixel: (px) each picture is composed of color points, each color point is a pixel, the size of the pixel can be changed, so it also becomes the "relative length"; the pixel said by the camera actually refers to the maximum number of pixels, such as 2 million = 1600 * 1200, the pixel is determined by the number of photosensitive elements on the photoelectric sensor in the camera, and a photosensitive element corresponds to a pixel. Therefore, the larger the pixel, the more photosensitive elements, the higher the corresponding cost.
Screen resolution: the number of pixels in each row of the screen * the number of pixels in each column; the resolution of the phone has been determined when it leaves the factory and cannot be changed.
Image resolution: the number of pixels per inch of image. Image resolution is in units, called pixels per unit (px/in)
Screen size: the physical length of only the diagonal of the screen, which cannot be changed, expressed in inches (in)
Screen pixel density: (ppi) refers to the number of pixels per inch on the diagonal of the screen; at a normal distance, when the PPI is higher than 300, the human eye can no longer distinguish the pixels.
Second, about the pixel size
The size of pixels is not fixed, however, an electronic device, after the factory screen resolution and the physical size of pixels is determined.
Why can the computer adjust the screen resolution?
The actual resolution of the computer is the maximum resolution, but when adjusted to a smaller resolution, the screen resolution is actually close to the actual resolution of the hardware by filling some analog color blocks.
III. Developer adaptation
There will be dp (dip), px, dpi, density in Android.
Dip: dp, device independent pixel
Px: pixels, but more information
Dpi:dots per inch, the number of pixels per inch, also known as pixel density (px/inch)
Density: density, density = actual dpi/ standard dpi, that is, actual dpi/ 160
By definition, when dpi is 160, dp equals px, and we get 1dp = 160*1inch.
There is also a definition of dpi: 1px = 1dpi * (1dp/160) = (1dpi/160) * 1dp
Therefore, the conversion formula for dp and px is:
1dp = px/ (Dpi/160) = (px*160) / Dpi = px/ density
1px = dp * (Dpi/160) = dp * density
Summary
120dpi (ldpi low density screen) 1dp = 0.75px (standard: 320mm 240) (since pixels are physical points, 2 pixels are used to display the contents of 3 dp)
160dpi (density screen in mdpi) 1dp = 1px (standard: 480,320)
213dpi (tvdpi TV density screen) 1dp = 1.33px
240dpi (hdpi high density screen) 1dp = 1.5px (standard: 800mm 480)
320dpi (xhdpi extremely high density screen) 1dp = 2px (standard: 600x124)
Picture adaptation
Give the UI according to the medium density screen, and then put it in the picture folder of different dpi
Size fit
Convert according to the formula in the values files of different dpi
The above is all the contents of the article "what are the unit sizes in android". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.