Android Screen Adapter recommendations

Source: Internet
Author: User

I. About layout adaptation1. Do not use absolute layout2, try to use match_parent instead of fill_parent. 3, can use the heavy place as far as possible to use the weight (android:layout_weight)4, if it is a solid color background, try to use the shape of android to Customize. 5. If you need to fit at a specific resolution, you can create a new layout-hxw.xml folder on the res directory . For example, to fit the 1080*1800 screen (Meizu MX3 with this resolution), create a new layout-1800x1080.xml folder, and then define the layout below. the Android system will first look for layouts with the same resolution and, if they don't exist, use the default layout under layouts.  second, about the picture production1, about the design:Design Plan first set a size to be designed, and as far as possible in the most popular screen size (for example, the current proportion of the screen is more than the 480 Series, that is, 480*800 or 400*854, the following icon making is also on a sub-basis for proportional conversion) on the design. first look at the level of the screen:
Screen level Screen density Ratio (relative) Physical Size (inches) Pixel size The usual resolution
ldpi 120 3 0.75 1 120
mdpi 160 4 1 1 160 320*480
hdpi 240 6 1.5 1 240 480*800
xhdpi 320 8 2 1 320 720*1280
xxhdpi 480 12 3 1 480 1080*1800
Description:Screen Level:Note that the screen level is graded by density and not related to pixels. If you want to make the density and pixel relationship, you need a frame of reference,Android use mdpi level as the standard reference screen, that is, in 320*480 The resolution of the phone on the previous density can hold one pixel. The other density levels are then compared on this basis. If ideally, The 480*800 screen can accommodate a density of 1.5 pixels. Physical Size:units are in inches instead of pixels, and the size of an inch at any resolution is the same, but the actual size of the pixels in a cell phone with different densities is not the same (that's why Android phones need to be adapted). and that's the point. 1 pixels in 160 1 " 1 pixels in 240 density on the basis of the show about 0.67 inches, in 320 0.5 inches. So there is a situation, a pixel on the computer, on different phones to see the actual size is not the same. So how do you make the "design effect" look like the area on a different phone? It is also assumed that a pixel is displayed in a density under the density, also assumed to be an inch. How many pixels will it take to display within an inch of the density level? The answer is 1.5 pixels (based on the rate conversion). Knowing the relationship, the next step is the creation of the icon. 2, about transduction. There are several suggestions about transduction:first, the length of the width is preferably a multiple of 3 (according to the android recommended logo icon size is mdpi),(hdpi),( xhdpi minimum number of conventions). second, the length of the width is preferably even. Because odd numbers can be problematic when they are being compressed. third, according to the above two, if the length of the width is a multiple of 6 ideal. Finally , if you can stretch without changing the design intent, such as a solid color background, use the android 9path tool to create a . 9 image. 3, about the matching of icons. And then everything is not related to the design manuscript. Based on a well-cut graph, it is based on the proportional relationship of screen density, pixel, and actual size. If the design division480*800resolution, and cut the diagram, if you need to fit720*1280screen, what should I do? According to the proportions, their relationship is2:3, so you need to follow 1.5 times timesscale making icons, such as when you480*800on the design manuscript cut down a20*20pixel graph, then you need to make a magnification30*30pixel icons so that the same icon480*800the screen and720*1280the actual size shown on the screen is just the same. Similarly, if you need to fitxxhdpiyou need to20*20on the basis of making a equal ratio amplified into40*40the icon for the pixel. 4, about the directory of icons,480*800 cut down the figure we placed in the drawable-hdpi directory, in accordance with the 2:3 enlarged icon placed in drawable-xhdpi directory, according to the 2 magnification of the icon placed in the drawable-xxhdpi Directory. Android will first find resources for the corresponding directory based on the density of the phone. For example, 408*800 resolution of the mobile phone if the density is a , then automatically load drawable-hdpi This directory icon, if the 720*1280 density is the drawable-xhdpi of the mobile phone automatically loading the icon under this directory. If you do not have this folder, look for the closest corresponding density folder. Third, othernext to say the estimate will let you down, according to the above steps can not completely solve the problem of adaptation, can only be appropriate, and even if the above steps are probably appropriate, the actual effect on the phone also has a discrepancy. mx3 1080*1800 in the standard case 480 524 480 Close, that is, will find drawable-xxhdpi this resource file. That means you're in 480*800 The resolution of the cut graph and then press twice magnification of the icon on this phone to display the effect is still smaller than the actual. The other problem is 540*960 or 640*960, whose density is likely to be either near or . The actual size shown on these phones may also be large or small, as a result of the drawings cut down on the 480*800 design and the adaptations made. To sum up, I just share my understanding and experience, but not perfect for the screen, just as a tip, if you pass by and see this advice, if you happen to have a better solution to fit, please advise.

Android Screen Adapter recommendations

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.