android-screen adaptation needs attention to the local summary _android

Source: Internet
Author: User
1. Use linear layout (linearlayout) and relative layout (relativelayout) As far as possible, do not use absolute layout.
2. Use dip and SP as far as possible, do not use PX.
3. Provide different layout files and pictures for different resolution.
For example:

4. Set up multiresolution support in Androidmainfest.xml.
Copy Code code as follows:

<supports-screens
Android:largescreens= "true"
Android:normalscreens= "true"
Android:anydensity= "true"
Android:smallscreens= "true"/>
 
To sum up :
1 android:anydensity= "True", the system will automatically find the corresponding folder according to the screen density.
2) android:anydensity= "false"
(1) If there is a different density representation of the same picture resource in the drawable-hdpi,drawable-mdpi,drawable-ldpi three folders, then the system will load the resources in the DRAWABLE_MDPI folder
(2) If there are high-density images in the DRAWABLE-HPDI, the other two folders do not have corresponding picture resources, then the system will load drawable-hdpi resources.
(3) If there is a picture resource in the drawable-hdpi,drawable-mdpi, there is no corresponding picture resource in drawable-ldpi, then the system will load the resources in drawable-mdpi folder

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.