Android multi-resolution adaptation

Source: Internet
Author: User

The android project was developed in the previous phase. Due to customer requirements for Multi-Resolution adaptation, it can support mainstream resolution mobile phones in China. Therefore, after several development times, many detours have taken place. At present, we have just learned some android multi-resolution adaptation methods.

First, we will introduce the detour. Because the layout file of android is stored in the layout of res, you can specify the specific layou parameter based on the resolution of different mobile phones ,:. Set multiple layout parameter layout files based on different mobile phones. Therefore, when the program is loaded, the layout file running at the resolution is displayed. The problem with this development is that there are a lot of layout files, which is messy. Inconvenient to manage. Many layout files need to be modified once modified. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + zai5/bfWzva3tLHg0uuyzr + fill + weight/weight + dmFsdWVzyejWw7PJtuDM16Gjus/A7bXEsry + Weight = "http://www.2cto.com/uploadfile/Collfiles/20140529/2014052909234647.png" alt = "\">. It can be seen that layout is a set of layout, but drawable can be multiple sets when resources are required. It is specially adapted based on different resolutions. The corresponding values must be multiple sets. In addition, the adaptation of values has all the corresponding data from low resolution 800x432 to high resolution 1280x752. In addition, hdpi and xhdip are independently adapted according to the density. This makes the code easier to maintain.

Therefore, based on the obtained information, I reconstructed the project. The following is the layout file after reconstruction ,.

Since there are not many image resources, we use a set of drawable and layout to use multiple sets of corresponding values. Run on different mobile phones. It basically meets the user experience. The data is completely displayed, and the effect is not distorted.

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.