Android Screen Adapter

Source: Internet
Author: User

Write a conclusion first

Layout adaptation:

1, do not use the relative layout, try to use the percentage layout

2. Use match_parent as much as possible

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 a 1080*1800 screen, create a new Layout-1800x1080.xml folder

Picture adaptation:

1, as far as possible to use 9 sister map

2, important pictures or smaller icons, according to the proportion of 3:4:6:8:12 design 5 sets, not important picture design set, based on 720 placed in xhdpi, based on 1080 placed in xxhdpi

Five picture folders corresponding density and general resolution

The actual zoom ratio of the picture (although visually the same)

The steps for the Android system to look for pictures are this:

1, go to the screen density corresponding to the directory to find. If you find it, take it.

2, if not found, go to a higher density than the directory inside to find, if found to use.

3, if not found, continue to look up. And so on

4, if the XXHDPI directory has not been found, it will go to the lower level than its own screen density of the directory to find, if the low level of the directory >=hdpi, found the use.

5, if not found, go to mdpi directory to find, if found, take it.

6, if not found, go to the default drawble directory to find, if found, take it.

7, if not found, then go to the lowest ldpi directory to find. If you find it, take it.

8, if not found, it is not found, the picture can not be displayed. (This is usually not the case, because if you don't have this picture in every directory, you're not compiling it.)

Android Screen Adapter

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.