Android application screen adaptation problem solving

Source: Internet
Author: User

1. Android Multi-screen support mechanism
Android's support for multi-screen mechanism is used to provide an appropriate way for the current device screen to co-manage and resolve application resources.
The Android platform supports a range of appropriate resources for the specified size (size-specific), specifying Density (density-specific) that you provide.
the appropriate resource for the specified size (size-specific) refers to small, normal, large, and XLarge.
the appropriate resource for specifying density (density-specific) refers to ldpi (low), MDPI (Medium), hdpi (High), and xhdpi (Extra high).
Android has an automatic matching mechanism to select the corresponding layout and picture resources
1) interface layout aspect
prepare 5 sets of layouts according to the size of the physical size:
Layout (Put some common layout XML files, such as the top and bottom layout of the interface, will not change with the screen size, like the WinDOS window title bar),
Layout-small (the screen size is less than 3 inches or so),
layout-normal (screen size is less than 4.5 inches or so),
layout-large (between 4 inches-7 inches),
layout-xlarge (between 7-10 inches)
2) Picture Resources
5 sets of picture resources need to be prepared according to the DPI value:
drawable: Primary placement of XML configuration files or images with lower resolution requirements
drawalbe-ldpi: Low-resolution images, such as QVGA (240x320)
DRAWABLE-MDPI: Medium-resolution picture, such as HVGA (320x480)
drawable-hdpi: High-resolution pictures, such as WVGA (480x800), FWVGA (480x854)
drawable-xhdpi: At least 960DP x 720DP
Android has an automatic matching mechanism to select the corresponding layout and picture resources.
The system will be based on the resolution of the machine to each of these folders to find the corresponding picture.
in the development of the program in order to be compatible with different screen different platforms, it is recommended that the respective folder according to the needs of different versions of pictures

2. androidmanifest.xml android list also to write permission to be able,Android from 1.6 and higher, Google to facilitate the developer for a variety of resolution models of the transplant and increased the function of automatic adaptation, The code is as follows:

<supports-screens android:largescreens= "true" android:normalscreens= "true" android:smallscreens= "true" Android: Anydensity= "true"/>

Each of the corresponding functions is a brief description:

< Span style= "font-family:arial; font-size:14px; line-height:26px; Background-color:rgb (255, 255, 255); " >android : anydensity=["true" | "false"]   does support a variety of different density screen  true for support, will automatically match the screen resolution, False  The system automatically scales the image size and coordinates of this image. Explain how the system automatically scales resources.  

< Span style= "font-family:arial; font-size:14px; line-height:26px; Background-color:rgb (255, 255, 255); " >android : largescreens=["true" | "false"]   Does IT support large screen  

android : smallscreens=["true" | "False"]  does support small screen

android:Normalscreens =["true" | "false" ] Screen to indicate whether the application supports normal form factors



/span>

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.