Android Multi-screen adapter for DP and PX relationshipsPeople have always asked me, Android multi-screen adaptation in the end is how to do, I do not know how to explain clearly, perhaps I am also quite confused.The following conclusions are mainly based on the analysis of the official documents Https://developer.android.com/guide/practices/screens_support.htmlAndroid due to fragmentation is too serious, and led to a very large number of kinds of mobile phone devices on the market, of course, a
value of a bit larger, the first value is generally refers to the width of the second value is a height.On the contrary, the mobile phone is generally less than the height of the width, so the first value is the width.The current popular device resolution address
Add several conceptsFull HD (All HD):1080 resolution, iphone7p is this.4K screen: Also known as QHD or UHD (Ultra HD), the minimum resolution is 38402160, TV with manyPixel of device camera:640*480 = 307200 = 300,000 pixels160
Pixel and millimeter conversions
The transformation also needs to know another parameter: DPI (how many dots per inch)
Number of pixels/DPI = inches
Number of inches * 25.4 = mm
There is a common way to display devices, whether they are printers or screens.
First with GetDeviceCaps (device handle, LOGPIXELSX)
Or
GetDeviceCaps (device handle, logpixelsy) gets the number of pixels per inch of the device
Note
business cards, brochures and other printed matter. Accurate color information can be obtained in CMYK mode, and objects are selected for special inks, such as silver, gold plated and metallic inks. If you choose 100% Cyan and 50% Magenta, the final print will get the color of the printed matter. A lot of printers will tell you the value of black four colors. If you want to get the black four-color printing effect, it may not be black enough. Black four colors will mix all ink to get a darker b
.
In addition, the Andong also supports the TARGET-DENSITYDPI private property, which represents the density level of the target device, which determines how many physical pixels the 1px in the CSS represents
target-densitydpi
Values can be one of a number or high-dpi, medium-dpi, low-dpi, device-dpi th
, and then calculate if the resolution is 800*600 pixel mode. If your line is 3 centimeters long, but on the screen, the monitor is always measured in pixels, so it's going to be converted to pixel metrics, about. Moreover, the most favorite unit of measurement for foreigners is inches, the width of the controls in VB is always used in twips (twips) (twips: Unit of measurement, equal to "pounds" of 1/20, inches of 1/1440. One centimeter has 567 twips. Pixel (Pixels): the smallest unit of resolut
Mobile device users more and more, the daily activation of Android phone has more than 1.3 million units, so we face the mobile Terminal WebApp also began to follow. This paper mainly introduces the relevant knowledge and experience of webapp development and debugging, and gives several optional solutions.I. Basic concepts (1) CSS pixels and device pixelsCSS Pixels: The abstract unit used by the browser, used primarily to draw content on a Web page.Device pixels: Displays the smallest physical u
Android divides the screen size into four types: small, normal, large, xlarge;The screen density is divided into: low (LDPI), Medium (MDPI), High (hdpi), Extra High (xhdpi), and the relationship between each screen density is as follows:
Density name
reference value for density (DPI)
Relationship
the corresponding screen resolution
xxxhdpi
640dpi
xxhdpi
480dpi
that calculate the value of each triangle vertex, such as the coloring of a 3D object. Based on these details, WPF specifies a render level value.WPF provides three levels of rendering, as follows:Rendering Tier 0: The graphics card will not provide any hardware acceleration features. This level corresponds to DirectX version 7.0 or lower.Rendering Tier1: The graphics card can provide some hardware acceleration features. This level corresponds to DirectX of 7.0 or more of the following versions
dynamically.3. How to fix the zoom ratioJust put it in place and print it out is not necessarily the result we want. Because the size of the bill is different, especially the Bank ID card or the amount of small lattice, playing crooked can only explain the technology is not home ah.So the placement is to have a basis, the basis is to scan the ticket, and then in the scanned basemap placed, the sample position will not be misplaced. The scaling is then the concept of
ObjectiveZxing Library is a library to identify the QR code, qzxing is a QT-based Qt Wrapper library, in this article we use it and qml to develop a small Android app.Add Qzxing ProjectQzxing is most commonly used as a subproject included in our project, in the pro file of our project, add the following sentence:include(./QZXing/QZXing.pri)Qzxing and our pro files are in the same directory.QML ProgramImport QtQuick2.0Import Qtquick.controls1.3Import Qtquick.window2.2Import Qtquick.dialogs1.2Impo
Wxga (1280x800)1024 × 7681280 × 768
1536 × 11521920 × 11521920 × 1200
2048 × 15362560 × 15362560 × 1600
2. How can we identify ldpi, mdpi, and hdpi?
Why ldpi, mdpi, and hdpi resolution? In my understanding, it is to achieve the best display effect under different screen density.
From the above, the resolution is not very reliable. How can it be reliable? In fact, as long as we know the screen resolution, screen size (diagonal line length), we can calculate the corresponding scree
androidmainfest:
Android: smallscreens = "true"
Android: normalscreens = "true"
Android: largescreens = "true"
Android: xlargescreens = "true"
Android: anydensity = "true"/>
If you do not have these lines of code, no matter how you adjust the controls in layout, the phone with the corresponding resolution has no effect. Note: Because different Android versions do not support xlargescreens, you can remove Android: xlargescreens = "true" directly.
Terms and concepts related to mobile phone reso
Android-Screen AdaptationAdaptation: the current application displays the same effect on the same mobile phone. Before adaptation, you must first determine the pixel density type (such as xhdpi, hdpi, and mdpi) to which the current mobile phone belongs. pixel density: number of pixels distributed per inch, unit (dpi, ppi ), it can be calculated by using the stock theorem.Vc7EtbWjrM/xy9jD3LbI1vfSqrfWzqo2uPa1yLy2oaM8YnI + CjxpbWcgc3JjPQ = "http://www.2c
first, some basic concepts1, Length (true length): inches, inch2. Resolution: density pixels per inch dpi (density)3, Pixels: px4, Dip formula: px/dip=dpi/160 so dip similar to inches, length (dp=dip,sp similar to dip) dip=160*inchdip= 160/dpi * pxWhen the dip is certain, the larger the DPI, the greater the PX5, genera
number of pixels in the vertical direction, in px,1px=1 pixels. Generally in portrait pixels * transverse pixels, such as 1960*1080.screen pixel density: the screen pixel density refers to the number of pixels per inch, in DPI, the abbreviation for dot per inch. Screen pixel density is related to screen size and screen resolution, in the case of single change, the smaller the screen size, the higher the resolution, the greater the pixel density, the
Android divides the screen size into four types: small, normal, large, xlarge;The screen density is divided into: low (LDPI), Medium (MDPI), High (hdpi), Extra High (xhdpi), and the relationship between each screen density such as the following:
Density name Reference
value for density (DPI)
Relationship
the corresponding screen resolution
xxxhdpi
640dpi
xxhdpi
48
picture, but their units are not pixels (Pixel), but himetric, we have to do is to convert himetric into Pixel.
First convert himetric into inches (Inch), 1 himetric = 0.01 mm,1 Inch = 2.54 cm, so 1 Inch = 2540 himetric.
Then convert from inch to pixel,1 inch equals how much pixel? This is determined by the system's DPI (Dot per Inch) setting, and the default value is 96.
Now you know where 2540 and 96 come from? However, the above code has two pr
Get ready
First, we can see in the Official document width and Height section that the unit in Rn is a DP, which is consistent with the units in Android.In the official website:
A DP is equal to one physical pixel on a screens with a density of 160.To calculate DPS:
dp = (width in pixels * 160)/
Here's screen density density, it's about equal to (dpi/160), in Rn we can get through Pixelratio: pixelratio.get () = = 1MDPI Android Device (160
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.