The most complete overview of Android screen adaptation

Source: Internet
Author: User

1, picture adaptation, different resolutions of the picture placed in the corresponding resolution of the Drawable folder, very few, generally only some of the more commonly used and "important" pictures will "cut a few sets of graphs"

2, the other resources of the adaptation, compare font size, spacing, etc., you can define a different resolution of the "Values" folder, and then set different "demin" values for different resolutions, the corresponding values in layout to take the values in Demin.

3,layout adaptation, and picture adaptation, generally rarely used, unless some "important" layout needs to guarantee the effect, or need to do on the "tablet" to do the matching

4, try to use linear layout, relative layout, if the screen does not fit, you can use ScrollView, it is important to note that the use of layout_weight in Scrowview is not valid, the size of the controls inside it is set to fixed

5, using "DIP" units, DP unit dynamic Matching

6, because the units written in the Android code are "px" (note that the unit of the font in the code is not PX, but the SP), all need to be "transformed" through the tool class

7, try to use the 9-patch chart, you can automatically according to the picture above the content is "stretched and shrunk"

8, using Layout_weight, is currently the most "recommended" Android multi-screen adaptive solution.

The effect of this property is to determine the display "weight" of the control in its parent layout, which is typically used in linear layouts. The smaller the value, the higher the priority;

Now the most popular is the 0px set value method, you can make the weight of the control and the value of a proportional example display.

9, the actual development, will first choose a mainstream resolution size development, such as 1280*720, he must be the interface to meet our requirements, other resolutions as long as the display is OK, basic can be, not all 100 points

10, the screen switch and layout, picture adaptation, you can do a separate set, but no need, or make it, or directly cut off

The most complete overview of Android screen adaptation

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.