Android supports different resolutions and sizes

Source: Internet
Author: User

For example, I recently made a device interface to adapt to different resolutions.

The implementation method is as follows:

First, you need to add sub-elements in the <manifest> element of the androidmanifest. xml file as follows:

<Supports-screens

Android: largescreens ="True"

      Android: normalscreens ="True"Android: anydensity ="True"

      Android: smallscreens ="True"> </Supports-screens>

 

  As expected, the above is to set multi-resolution support for our screens (more accurately, it is to adapt to three types of density: large, medium, and small ).Android: anydensity ="True ",This sentence plays a very important role in the entire screen. The value is true. When our application is installed on mobile phones of different density, the program loads hdpi and mdpi respectively, resources in the ldpi folder.

 Conversely, if the value is setFalse. Even if we have the same resource in the hdpi, mdpi, and ldpi foldersApplicationIt will not automatically go to the corresponding folder to find resources. This situation occurs on high-density and low-density mobile phones, such as a 240x320 pixel mobile phone. If you set Android: anydensity ="False ",Android system will
X 320 (low density) is converted to 320x480 (medium density). In this case,ApplicationThe resources in the mdpi file will be loaded on the cell phone with a small density.

Drawable-hdpi, drawable-mdpi, drawable-ldpi. drawable-xhdpi. drawable-large drawable-small drawable-xlarge
It is implemented by placing images of different sizes inside
Of course, layout-hdpi Layout-large... is also used for layout.

Example: http://download.csdn.net/detail/penglijiang/4952093

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.