Android development screen adaptation, android development adaptive

Source: Internet
Author: User

Android development screen adaptation, android development adaptive

Solution 1: place a set of images in different dpi drawable. When the system reads the dpi of the mobile phone hardware, it automatically obtains the images in the corresponding drawable folder. This solution can only partially solve the problem.

Solution 2: recommended method; set the corresponding layout for mobile phones of different screens. For example, the resolution of MX3 mobile phone is 1800*1080, then add a new layout folder in the res folder named layout-1800x1080.

Some phones are 1280*720, a new layout is added as a layout-1280x720. In this case when your test machine is 1280x720 screen, it will read the layout inside the layout-1280x720, when it is a 1800*1080 screen, it will load the layout inside the layout-1800x1080.

When the screen of the test machine is in other circumstances, a bug occurs. the solution is to set a layout folder without parameters. When the test machine screen does not match the set accurate parameter layout, the layout in the layout folder without parameters is loaded.

Solution 2 has been tested, and the effect is good.

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.