Android Localization Resource Directory detailed

Source: Internet
Author: User

We can imagine that there are two different resolutions of mobile phones (320*480 and 480*800) to use some image resources, in order to make the image is not distorted, you need to specify different images for different resolutions of the phone, you need to create a different resource directory.

3 Image resource directories were created in the Res directory: drawable, drawable-hdpi, and drawable-mdpi. Where drawable is the image resource directory for the default image, drawable-hdpi preserves the image resources used in high screen density (referred to as 480*800 or similar resolution), DRAWABLE-MDPI saves the medium screen density (value 320* 480 or similar resolution) in the case of the resource used.

If the current phone is a high-density screen (with a resolution of 480*800 or similar values), the system will automatically recruit the appropriate image resources into the drawable-hdpi directory. If it is a medium density screen (with a resolution of 320*480 or similar values), it will go to the drawable-mdpi directory to conceive the corresponding image resource. Of course, if it is a low density (resolution of 320*480 or similar values), the corresponding image resource will be found in the default drawable directory. The image filenames in these 3 image resource directories are identical. In addition to screen density, you can localize control of screen orientation, language, Android SDK version, and many other aspects. The portion of the default resource directory name that is followed by a hyphen (-) connection (such as hdpi, MDPI, and so on) is referred to as the configuration identifier.

The following table is the configuration identifier supported by the Android SDK.

The Android SDK supports the configuration of the Peugeot symbol

configuration identifier

identifier value

MCC

MNC

example:

mcc310;

mcc310-mnc004;

mcc208-mnc00.

MCC (Mobile Country Code, Moblie country code) and optional MNC (mobile network Code , Moblie network code) is the information read from the SIM card. For example, Mcc310 says U.S. carriers, MCC310-MNC004, a Verizon operator in the US, mcc208-mnc00 the orange operator in France.

If the device uses a wireless connection (radio connection) (GSM phone), the MCC reads the SIM card while the MNC reads from the network to which the device is connected.

You can also use MCC alone (for example, you can include legal resources for a specific country in your application). If you only want to know the language, you can use the language and region identifiers (discussed below). If you feel you are using MCC and MNC identifiers, you should carefully test whether it works correctly.

language (Language)

example:

zh-rch ;

en;

FR;

en-rus;

RF-RFR;

RF-RCA;

The language identifier is defined as a two-letter code, which is defined in detail to refer to iso 639-1. The zone identifier is optional, You can also use a two-letter code (but with a lowercase "r" in front of the code) to define the relevant content of the iso 3166-1-alpha-2.

languages and regions are case insensitive. The "R" prefix is used to differentiate a place, but you cannot specify a region individually, that is, the specified range must first specify the language.

If the user and region change the current language in the system settings, the program will change its language at run time (select the Resource directory read resource that matches the current language)

Layout direction (layouts Direction)

Example:

Ldrtl, ldltr

Ldrtl represents a right-to-left layout, and LDTLR represents a left-to-top layout.

Minimum API level:17 (Android 4.2)

Minimum screen width

(Smallestwidth)

SW<N>DP, where N represents an integer.

Example:

SW320DP;

SW600DP;

SW720DP.

The minimum screen width of the pixel. The so-called minimum hire width is the width (number of pixels) of the smallest edge of the Android device screen, for example, the minimum width of the screen with 480x800 is 480, and the minimum width does not change with the screen orientation.

Here are some common screen size settings.

SW320DP:

240X320LDPI (QVGA screen phone);

320X480LDPI (medium density screen cell phone);

480X800LDPI (High-density screen mobile phone).

SW480DP:480X800MDPI (medium density mobile phone or tablet PC);

SW600DP:600X1024MDPI (A medium-density 7-inch tablet, such as a Nexus 7, is part of this device);

SW720DP:720X1280MDPI (Medium-density 10-inch tablets, such as Nexus 10, are part of this device).

The minimum screen width includes not only areas that the user can use, but also areas that are not available (such as the system status bar). The system selects a resource directory that is close to (not exceeding) the minimum width of the current screen. For example, the current screen minimum width is 600, and the resource directory has a RES/DRAWABLE-SW580DP directory, and the system uses resources in that directory, because 580 is close to 600 and does not exceed 600.

Minimum API level:13 (Android 3.2)

Some readers may wonder why there are two 480x800. In fact, the two 480x800 resolutions are different, one is medium density (SW480DP) and one is high density (SW320DP). In order to make a tablet, it often makes the screen very large, such as 6 inches or 7 inches, but in order to save costs, although the screen size is increased, but the screen resolution does not increase, which means that the density of the screen (the number of pixels in the absence of inches) is reduced. That is to say, a 4-inch high-density screen (resolution is 480x800) of the phone programming 7-inch tablet, but the resolution is still 480x800. So while the 7-inch tablet is bigger than a 4-inch phone, the screen density is lower, In fact, the flat panel display does not have the same resolution of the phone effect is good. For example, although the resolution of the Nexus 7 is 1280x800, the display does not have a high screen density of Nexus 4 because it is in the screen density.

The width of the screen you can use

(Available width)

W<N>DP, where N represents an integer.

Example:

W720DP;

W1024DP.

The minimum width that the screen can use. The width here is the width of the value from the left side of the screen to the right. When the orientation of the screen changes, the width that can be used varies. For example, the screen resolution of the Nexus 7 is 1280x800, if the Nexus 7 is placed horizontally (the edge is a side length), the width is 1280, if you place the Nexus 7 vertically (with a short edge on the bottom), you can use a width of 800.

For example, the path to the two main_activity.xml files is as follows:

1.res/layout-sw600dp/main_activity.xml

2.res/layout-sw600dp-w720dp/main_activity.xml

Suppose the program runs on Nexus 7. When the Nexus 7 is placed vertically, the screen width you can use is 800, and the minimum screen width is 800, so the system uses the Main_activity file in the 1th resource directory. When the screen orientation changes to landscape, the screen width is 1280, and the 2nd Resource Directory is 720 (it needs to be converted to the actual pixel width, the Nexus 7 screen density is 216, so the pixel width is 720x216/160= 972) closest to 1280 (the system chooses the closest localized resource directory). So this is the system will use the Main_activity file in the 2nd resource directory.

Minimum API level:13 (Android 3.2)

Screen height that can be used

(Available height)

H<N>DP, where N represents an integer.

Example:

H720DP;

H1024DP.

The minimum height that the screen can use. The height here is the height of the value from the top of the screen to the bottom of the screen. When the screen orientation changes, the height that can be used changes as well. For example, the Nexus 7 screen resolution is 1280x800, if the Nexus 7 is placed horizontally (the edge is the side length), the height can be used is 900, if the Nexus 7 is placed vertically (the bottom side is a short edge), you can use a width of 1280.

For example, the path to the two main_activity.xml files is as follows:

1.res/layout-sw600dp/main_activity.xml

2.res/layout-sw600dp-w720dp/main_activity.xml

Suppose the program runs on Nexus 7. When the Nexus 7 is placed horizontally, the screen height that can be used is 800, and the minimum screen height is 800, so the system uses the Main_activity file in the 1th resource directory. When the screen orientation becomes portrait, the screen width you can use is 1280, and the 2nd Resource Directory of 720 (needs to be converted to the actual pixel width, the Nexus 7 screen density is 216, so the pixel width is 720x216/160= 972) closest to 1280 (the system chooses the closest localized resource directory). So this is the system will use the Main_activity file in the 2nd resource directory.

Minimum API level:13 (Android 3.2)

screen size

small;

normall;

large;

xlarge.

small: Use a low-density QVGA screen. This screen is the same width as the HVGA, but smaller than the HVGA height. HVGA's screen scale is 2:3, while QVGA is 3:4. The minimum resolution of the QVGA is approximately 320x426, for example, QVGA low density and VGA density are close to this resolution.

normal: Use the VGA medium density screen. The approximate resolution of the screen is 480x640. For example, the medium density screen for VGA and WVGA is close to this resolution.

xlarge: High-density-based screens. The screen resolution is approximately 720x960. This large resolution requires a api level of at least 9, which means that the android 3.1 and later versions support this large-resolution screen.

min api level:4 (android 1.6)

Screen appearance

(Screen Aspect)

Long

Notlong.

Long: Seemingly longer screens, such as WQVGA, WVGA, FWVGA.

Notlong: A screen that does not look long, such as QVGA, HVGA, VGA.

Screen orientation

(Screen Orientation)

Port

Land

Port: Sets the vertical (or portrait) direction;

Land: Sets the horizontal (or landscape) direction.

ui mode

(ui  mode)

car;

desk;

Television;

application;

car: Settings are placed on the car base;

desk: The settings are placed on the desktop base;

television: The device outputs the screen through the TV. Usually when watching TV users will be far away from the larger screen of the TV, usually more than 3 meters away from the TV to watch, so the process of watching Android on TV is called the "10-foot user experience" is the user's TV screen is far from the meaning. This situation is mainly used for keyboard manipulation or other methods of fee-touch interaction (a few meters away from the screen, of course, cannot touch the method).

appliance: The device does not have an interface (UI), it simply serves the service. For example, if Android is controlled by a robot, the UI may not be needed, but only the input and output of the person can be processed.

minimum api level:8 (android 2.2)

television minimum api level:13 (Android  3.2)

Night mode

(night  mode)

night;

notnight.

night: Night,

notnight: Daytime.

min Apilevel:8 (android 2.2)

screen pixel density

ldpi;

MDPI,

hdpi;

xhdpi;

nodpi;

tvdpi.

ldpi: low-density hire, density of about 120dpi;

hdpi: high-density screen, density is about 240dpi;

XHDPI: Extended high-density screen, The density is about 320dpi. The minimum value of Api level 8 (android 2.2);

nodpi: Applied to bitmap resources that do not require more screen density for stretching;

Touch screen Type

(Touchscreen Type)

Notouch

Finger

Notouch: Setting does not support touch screen.

Finger: Settings Support touch screen (may only support fingers, may also support both stylus and finger support).

Available keyboards

(Keyboard availability)

keysexposed;

Keyshidden;

Keyssoft.

Keysexposed: Set the keyboard to be available (including software disks and physical keyboards). The device keyboard can be divided into the following 2 situations:

L only soft keyboard, no physical keyboard or physical keyboard is disabled. This value is only used for soft keyboards.

L only physical keyboard, no soft keyboard or soft keyboard is disabled. This value is only used for physical keyboards.

Keyshidden: The device has a physical keyboard, but the physical keyboard is hidden (not pulled out), and the device does not have a soft keyboard available.

Keyssoft: The device has a 12-key physical keyboard, regardless of whether the soft keyboard is available.

Preferred text Input Method

(Primary Text Input Method)

Nokeys;

Qwerty

12key.

Nokeys: The device does not have physical keys for text input;

QWERTY: The device has a physical querty (same as a standard computer keyboard) keyboard, regardless of whether the physical keyboard is available to the user;

12key: The device has a 12-key physical keyboard, regardless of whether the physical keyboard is useful to the user.

Whether there is a navigation key

(Navigation key availability)

navexposed;

Navhidden.

Navexposed: There are navigation keys, the user can use this navigation key;

Navhidden: The navigation key is not available (for example, the flap phone does not open the lid).

preferred non-lending navigation send

(Primary non-touch navigation method)

Nonav,

dpad;

trackball;

wheel.

nonav: The device does not have a non-touch navigation;

trackball: The device is navigated by the trackball,

wheel: The device is navigated by a pulley.

Platform version

(Platform Version[api level])

Example:

V3;

V4;

V7;

Wait a minute

Minimum version of the API level. For example, V1 represents API Level 1 (requires Android 1.0 and above), V7 represents API Level 7 (requires Android 2.1 and above).

Note: Although the platform this identifier can match is equal to or greater than the current Android version, Android 1.5 (V3) and Android 1.6 (v4) are two exceptions. There is a bug in these two editions. Therefore, using the platform version identifier in these two versions can only accurately match the current Android version. That is, if only for V3, then only Android 1.5 will satisfy this identifier. This bug has been fixed after Android 1.6 version.

Next: Android screen adaptation problem explained: Http://www.cnblogs.com/stafen/p/3833087.html

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.