Android UI Adaptation Qualifier

Source: Internet
Author: User

Introduction

For the program to execute on different sizes of Android machines, the applicability of the UI caused additional overhead, just the qualifier, it is very convenient to overcome the problem. Resolve resource onboarding by creating qualifiers related folders.

Qualifier use

Qualifiers (MDPI,TVDPI,HDPI) can help us infer screen density
Qualifiers (Land,port) help us to distinguish screen status
Qualifier (En,fr ...) can help our language and region
Qualifier (V3,v4 ...) can help us differentiate the Android version number
Qualifier (1024x600 ...) A screen that can be adapted to compute virtual keys or not to compute virtual keys
......

Android SDK Supporting multiple screens topics
Supporting multiple Screens

Qualifier List
features Qualifier Descriptive narrative
Screen size Small
Normal
Large
XLarge
Small: Such a screen is similar to a low-resolution QVGA screen. The minimum layout size for a small screen is approximately 320X426DP. For example QVGA low resolution and VGA high resolution.
Normal: Such a screen similar to the medium-resolution HVGA screen. The minimum layout size for a normal screen is approximately 320x470dp.

Such as. WQVGA Low resolution screen, HVGA medium resolution screen, WVGA high resolution screen.
Large: Such a screen is similar to a medium resolution VGA screen. The smallest layout size for a large screen is approximately 480X640DP. such as VGA and WVGA medium-resolution screen.
XLarge: Such a screen is considered larger than the traditional medium-resolution HVGA screen. The minimum layout size for the XLarge screen is approximately 720x960dp.

In most cases, such a large-screen device is too large to carry in a backpack, and most likely a flat-style device.
Note: Using a dimension qualifier does not imply that the resource is used only for this size screen. Assuming that no practical qualifier provides an optional resource that matches the current device configuration, the system uses the resource closest to the configuration.


Caution: Assume that all resources using the dimension qualifier are larger than the current screen, then the system will not use them. And the application crashes when it executes (for example,. Assume that all layouts are marked with the XLarge qualifier, while the device is a normal-sized screen.
This qualifier is added to the version number after API level 4.

Screen orientation Port
Land
Port: Portrait device (vertical)
Land: Horizontal equipment (horizontal)
Assuming the user rotates the screen, this qualification can be changed during application execution.
The Orientation configuration field indicates the direction of the current device.

screen pixel density (dpi) ldpi
mdpi
hdpi
xhdpi
nodpi
tvdpi
ldpi: Low-resolution screen for approximately 120dpi.
MDPI: Medium resolution screen for approximately 160dpi (on traditional HVGA);
hdpi: High resolution screen for approximately 240dpi;
xhdpi: Ultra-high resolution screen for approximately 320dpi. is added to the version number after API basic 8;
Nodpi: This limit is used for bitmap resources that do not want to be scaled based on the matching device resolution.
tvdpi: The screen between MDPI and hdpi. It's about 213dpi. Such groupings are not basic resolutions, most of which are considered for television. And most applications do not need it-the provision of MDPI and hdpi resources is sufficient to meet the needs of most applications. And the system will scale them appropriately.

This qualifier is introduced after API level 13. The scaling ratio between the
four basic resolutions is: 3:4:6:8 (ignoring tvdpi resolution), so a 9x9 ldpi bitmap. In MDPI is 12x12, 18x18 in hdpi, xhdpi in 24x24.


Assume that you feel a bad picture on your TV or some other device, and you want to try tvdpi resources. Then the scaling factor is 1.33*mdpi. For example, a picture of a 100px x 100px mdpi image should be enlarged to a 133px x 133px tvdpi image.
Note: Using the resolution qualifier does not imply that the resource applies only to screens with corresponding resolutions. The

assumes that the closest resource is used if it does not provide an optional resource that matches the current device configuration.

MCC and MNC mcc310
mcc310-mnc004
Mcc208-mnc00
such as
MCC is the English acronym for Mobile Country codes (the country code). It is later optionally trailing the mobile network code from the SIM card inside the device (mnc:mobile. As in whatever carrier. MCC310 represents the United States. MCC310-MNC004 represents the Venizon company in the United States. MCC208-MNC00 represents the orange company of France.
Assuming that the device uses an audio connection (GSM phone), then the values of the MCC and MNC are from the SIM card.
MCC can also be used alone (for example, in applications that include legitimate resources from a particular country).

Assuming you only need to specify a locale, you can use the language and region qualifiers instead (discussed later). Assume that you decide to use MCC and MNC qualifiers. We have to test it carefully. Enable it to meet the work you expect.
You can also view the configuration domain MCC and MNC, which indicate the current mobile country code and the mobile network code, respectively.
Mcc:http://developer.android.com/reference/android/content/res/configuration.html#mcc
Mnc:http://developer.android.com/reference/android/content/res/configuration.html#mnc

Languages and regions En
Fr
En-rus
Fr-rfr
Fr-rca
such as
The language is defined by the two-letter ISO 639-1 language code. followed by the optional two Iso-3166-1-appha-2 region code letters (preceded by lowercase "R").
This encoding does not differentiate between uppercase and lowercase. The r prefix is used to differentiate between regions and cannot be specified separately.
Assuming that the user has changed the language setting in the system, it can be changed to the appropriate language during application execution.
Minimum width SW<N>DP
For example:
SW320DP
SW600DP
SW720DP
etc
The basic size of the screen refers to the shortest available screen area.

Verbose. The minimum width of the device is the shortest possible width and height of the screen (it can also be seen as the minimum width of the screen). This allows you to use this qualifier to ensure that the application has at least <n>dp width available for the UI interface, regardless of the current orientation of the screen.


For example, if the layout requires at least 600DP minimum screen size at any time, you can use this qualifier to create a layout resource in the res/layout-sw600dp/folder. The system will only use these resources when the available screen size is at least 600DP. Regardless of whether the 600DP is a user-perceived height or width. The minimum width is the fixed screen size feature of the device, when the orientation of the screen changes. The minimum width of the device does not change. The minimum width of the
device requires consideration of screen decorations and system UI usage. Like what. Suppose the device has some fixed UI elements that go along the minimum width of the axis, taking up a certain amount of screen space. The minimum width of the system declaration is smaller than the actual screen size. Because the portion of the pixel that is occupied by the system is not valid for the UI of the user application. Therefore, this value should be the minimum actual size required for the application layout (typically, this value is the minimum width supported by the layout.) Regardless of the current orientation of the screen).
The following are some of the values that can be used for a common screen size:
1.320. Devices configured for the following screen:
240x320ldpi (QVGA handheld device)
320X480MDPI (handheld device)
480x800hdpi (high-resolution handheld device)
2.480, for 480x800mdpi screen (tablet or handheld device)
3.600. Screen for 600x1024mdip (7-inch tablet)
4.720, for 720x1280mdip screen (10-inch tablet)
When the application provides multiple minimum-width qualifier resource folders with different values. The system uses the resource that is closest (not exceeding) the minimum width of the device. The
qualifier is added to API level 13. The
also depends on the ANDROID:REQUIRESSMALLESTWIDTHDP property, which declares the minimum minimum width that is compatible with your application. And the SMALLESTSCREENWIDTHDP configuration field holds the value of the device's minimum width.

Available widths w<N>dp
Like what:
W720dp
W1024dp
such as
Specifies the minimum available screen width. The value in the resource that should be defined in DP units <N> .

When the direction changes between landscape and portrait. This configuration value will match the current actual width.
When an application gives this configuration a resource folder with several different values, the system uses the one that is closest to (not exceeding) the current screen width of the device.

This value needs to take into account the space occupied by screen decorations. Therefore, assuming that the device has some fixed UI elements on the left or right side of the display, the width value used will be smaller than the actual screen size. Due to the use of these fixed UI elements, the available space for the application is reduced.


This feature is added to the API level 13 and depends on the SCREENWIDTHDP configuration field. It holds the current screen width.

Available height h<N>dp
Like what:
H720dp
H1024dp
such as
Specifies the minimum available screen height, the value that should be defined in DP in the resource, when the direction changes directly in both landscape and portrait orientation. This configuration value should match the current actual height.
When the application gives this configuration multiple resource folders with different values. The system uses the configuration that is closest to (not exceeding) the current screen height of the device.

This takes into account the occupancy of the screen decorations, so assume that the device has some fixed UI elements above or below the display. The height values to be used are smaller than the actual screen size, resulting in reduced free space for the application due to the use of these fixed UI elements.

Non-fixed screen decorations (such as the status bar of a phone can be hidden in full screen) are not considered, such as the title bar or the action Bar of the form decoration is not considered, so the app must be prepared to deal with less than the space they specify.


This qualifier is added to API level 13.
Also see the SCREENHEIGHTDP configuration field. It holds the height of the current screen.

Screen appearance Long
Notlong
Long: Longer screen, such as WQVGA, WVGA, FWVGA
Notlong: Non-long screen, such as QVGA, HVGA, VGA
This qualifier is added to the version number after API level 4
This qualifier is completely based on the appearance ratio of the screen. does not correspond to the orientation of the screen.


Also see the Screenlayout configuration field, which indicates whether the screen is a long screen.

Berth mode Car
Desk
Car: The device is parked in the car
Desk: The device is docked in the desk
This qualifier is added to the version number after API level 8, assuming that the user has changed the docking location of the device, and can change this qualification during the execution of the application.

The ability to use the Uimodemanager object to enable or disable such a pattern.

Night mode Night
Notnight
Night: Night
Notnight: Daytime
is added to the version number after API level 8, assuming that the night mode is kept in its own active mode (default), the pattern changes based on daylight time during application execution. The ability to use the Uimodemanager object to enable or disable such a pattern.
Touch screen Type Notouch
Stylus
Finger
Notouch: Non-touchscreen device
STYLUS: A resistive screen device for the stylus
Finger: Touch Screen device
The Touchscreen configuration field indicates the type of touch screen on the device.
Availability of keyboard Keysexposed
Keyshidden
Keyssoft
Keysexposed: The device has a keyboard available. Assuming the device has a soft keyboard enabled, the qualifier can be used even when the hard keyboard is not exposed to the user. Assuming that no soft keyboard or soft keyboard is available, it is only sufficient to use the qualifier when the hard keyboard is exposed to the user.
Keyshidden: The device has a hard keyboard available. But it was hidden. And the device does not have a soft keyboard available.
Keyssoft: The device has a soft keyboard available, regardless of whether it is visible or not.
Assume that keysexposed resources are provided. But there are no keyssoft resources, so only the system has a soft keyboard available. The system uses keysexposed resources regardless of whether the keyboard is visible or not.
Assume that the user has a hard keyboard open. This qualification can be changed during application execution.
The Hardkeyboardhidden and Keyboardhidden configuration fields indicate the visibility of the hard keyboard and the visible keyboard type (including the soft keyboard), respectively.
Main text Input Method Nokeys
Qwerty
L2key
Nokeys: The device is not practical for text input hard keyboard;
QWERTY: The device has a standard hard keyboard. Whether the user is visible or not;
12key: The device has a hard keyboard with 12 keys, regardless of whether the user is visible or not.
The Keyboard configuration field indicates the primary text input method that is available.

Validity of navigation keys Navexposed
Navhidden
navexposed: The navigation key is available to the user;
Navhidden: The navigation key is not available.
Assuming that the user is able to see the navigation key, the limit can be changed when the application executes.
Navigationhidden the configuration field to indicate whether the navigation key is hidden.

Basic non-touchscreen navigation methods Nonav
Dpad
Trackball
Wheel
Nonav: In addition to using the touchscreen, the device has no other navigational facilities.


Dpad: The device is useful for navigating the orientation Board (D-PAD).


Trackball: Device useful for navigating trackball.


Wheel: The device is useful for navigating the steering wheel (uncommon).
Navigation
The configuration field indicates the type of navigation method available.

Platform version number (API level) Like what:
V3
V4
V7
such as
The API level supported by the device.

If V1 represents API Level 1 (Devices with Android1.0 or higher), V4 represents API level 4 (devices with Android1.6 or higher)
Warning: Android1.5 and 1.6 are only available if the qualifier matches the platform version number exactly. Talent Matching Resources

Qualifier Demo Sample

You just need to use the line and qualifier,xx-限定符

Qualifier Execution Order

The qualifier match is a downward match. Search from high to low.

Blog name: Wang Leping Blog

Blog Address: http://blog.lepingde.com

CSDN Blog Address: http://blog.csdn.net/lecepin



Android UI Adaptation Qualifier

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.