Android UI Adaptation Qualifier

Source: Internet
Author: User

Introduction

For the program to run on different sizes of Android machines, the applicability of the UI caused additional overhead, but the advent of qualifiers, it is convenient to solve the problem. Resolve the load of the resource by creating a qualifier-related folder.

Qualifier use

Qualifiers (MDPI,TVDPI,HDPI) help us to determine screen density
Qualifiers (Land,port) help us to distinguish screen status
Qualifier (En,fr ...) can help us with languages and regions
Qualifier (V3,v4 ...) can help us differentiate the Android version
Qualifier (1024x600 ...) A screen that can be used to compute virtual keys or not to compute virtual keys
......

Android SDK Supporting multiple screens topics
Supporting multiple Screens

Qualifier List
features Qualifier Description
Screen size Small
Normal
Large
XLarge
Small: This 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: This kind of screen is similar to the medium resolution HVGA screen. The minimum layout size for a normal screen is approximately 320x470dp. For example, WQVGA low resolution screen, HVGA medium resolution screen, WVGA high resolution screen.
Large: This kind of screen is similar to the medium resolution VGA screen, the smallest layout size for large screen is about 480X640DP. For example, VGA and WVGA medium resolution screen.
XLarge: This 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, this 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. If you do not provide a qualifier with an optional resource that matches the current device configuration, the system uses the resource closest to the configuration.
Warning: If all resources using the dimension qualifier are larger than the current screen, then the system will not use them, and the application will crash at run time (for example, if all layouts are marked with the XLarge qualifier and the device is a normal-sized screen).
This qualifier is added in the version after API level 4.
Screen orientation Port
Land
Port: Portrait device (vertical)
Land: Horizontal equipment (horizontal)
If the user rotates the screen, this limit can be changed while the application is running.
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 approx. 320dpi is added in the version 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 is approximately 213dpi. This grouping is not the primary resolution, most of it is for TV, and most applications do not need it-providing mdpi and hdpi resources to meet the needs of most applications, and the system scales them appropriately. This qualifier is introduced after API level 13. The scaling ratio between the
four primary resolutions is 3:4:6:8 (ignoring the tvdpi resolution), so a 9x9 ldpi bitmap, mdpi in 12x12, hdpi in 18x18, xhdpi in 24x24.
If you feel that the picture resources on your TV or some other device are not looking good, 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 is applicable only to the screen with the corresponding resolution. If you do not provide an optional resource that matches the current device configuration, the system uses the closest resource.
MCC and MNC mcc310
mcc310-mnc004
Mcc208-mnc00
such as
The MCC is the English acronym for the Mobile Country Code, which optionally follows the mobile network code from the SIM card in the device (mnc:mobile. Country). As on any carrier, mcc310 represents the United States, mcc310-mnc004 represents the Venizon company of the United States, and MCC208-MNC00 represents the orange company of France.
If 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 separately (for example, in applications that contain legitimate resources from a particular country). If you only need to specify a locale, you can use the language and region qualifiers instead (discussed later). If you decide to use MCC and MNC qualifiers, you should test carefully to make it work as 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 an optional two iso-3166-1-appha-2 region code letter (preceded by the lowercase "r").
This encoding is case-insensitive, the R prefix is used to differentiate between regions and cannot be specified separately.
If the user changes the language setting in the system, it can be changed to the corresponding language during the application's operation.
Minimum width sw<N>dp
For example:
Sw320dp
Sw600dp
Sw720dp
such as
The basic size of the screen refers to the shortest available screen area. In particular, 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 the width available to 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/directory. These resources are only used when the size of the available screen 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, and the minimum width of the device does not change when the orientation of the screen changes.
The minimum width of the device requires consideration of screen decorations and system UI occupancy. For example, if the device has some fixed UI elements that take up a certain amount of screen space along the minimum width of the axis, 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).
Here are some values for the common screen size that you can use:
1.320, the device 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, for 600x1024mdip screen (7 inch tablet)
4.720, for 720x1280mdip screen (10 inch tablet)
When an application provides multiple minimum width qualifier resource catalogs with different values, the system uses the resource that is closest (not exceeding) the minimum width of the device.
This qualifier is added to API level 13.
Also look at the ANDROID:REQUIRESSMALLESTWIDTHDP property, which declares the smallest minimum width compatible with your application, and the SMALLESTSCREENWIDTHDP configuration field holds the value of the device's minimum width.
Available widths w<N>dp
For example:
W720dp
W1024dp
such as
Specifies the minimum available screen width, and the value that should be defined in DP for the resource <N> . When the direction changes between landscape and portrait, this configuration value matches the current actual width.
When an application gives this configuration a resource directory with several different values, the system uses the configuration that is closest to (not exceeding) the current screen width of the device. This value takes into account the space occupied by the screen decorations, so if 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, because the use of these fixed UI elements reduces the available space for the application.
This feature is added in API level 13 and depends on the SCREENWIDTHDP configuration field, which holds the current screen width.
Available height h<N>dp
For example:
H720dp
H1024dp
such as
Specify the minimum available screen height, the value that should be defined in DP in the resource, and the configuration value should match the current actual height when the direction changes directly in landscape and portrait orientation.
When an application provides multiple resource catalogs with different values for this configuration, 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 if the device has some fixed UI elements above or below the display, the height value to use is smaller than the actual screen size, as these fixed UI elements are occupied, allowing the application to reduce the available space. 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 such as window decoration is not considered, so the application must be prepared to deal with less than the space specified by the case.
This qualifier is added to API level 13.
Also look at the SCREENHEIGHTDP configuration field, which 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 in the version after API level 4
This qualifier is completely based on the appearance ratio of the screen, not relative 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 API Level 8 version, and if the user changes the docking location of the device, the limit can be changed during the run of the application. You can use the Uimodemanager object to enable or disable this mode.
Night mode Night
Notnight
Night: Night
Notnight: Daytime
is added in the version after API Level 8, if the night mode is kept in automatic mode (the default), the pattern changes based on daylight time during the application run. You can use the Uimodemanager object to enable or disable this mode.
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. If the device has a soft keyboard enabled, this qualifier can be used even when the hard keyboard is not exposed to the user. If you do not provide a soft keyboard or a soft keyboard is disabled, you will only be able to use this qualifier if the hard keyboard is exposed to the user.
Keyshidden: The device has a hard keyboard available, but it is 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.
If a keysexposed resource is provided, but there is no keyssoft resource, the system uses keysexposed resources regardless of whether the keyboard is visible, as long as the system has a soft keyboard available.
If the user has a hard keyboard open, you can change this qualification while the application is running.
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 does not have a hard keyboard for text input;
QWERTY: The device has a standard hard keyboard, regardless of whether the user is visible;
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.
If the user is able to see the navigation key, the limit can be changed while the application is running.
Navigationhidden the configuration field to indicate whether the navigation key is hidden.
The main non-touchscreen navigation method Nonav
Dpad
Trackball
Wheel
Nonav: In addition to using the touchscreen, the device has no other navigational facilities.
Dpad: The device has a directional plate (d-pad) for navigation.
Trackball: The device has a trackball for navigation.
Wheel: The device has a directional wheel for navigation (uncommon).
Navigation
The configuration field indicates the type of navigation method available.
Platform version (API level) For example:
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 can match resources only if the qualifier matches the platform version exactly
qualifier Example

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

Qualifier Execution Order

The qualifier match is a downward match, which is found 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.