The steps are simple and require only two steps:
1. Create a resource subdirectory with the configuration modifier for the target language
2. Put the optional resources in this directory, the Android system will automatically handle the subsequent work
Here we need to explain the configuration modifiers.
Config modifier for Chinese:-zh, then we need to create a new two subdirectory in the Res directory: Res/raw-zh,res/values-zh.
For subdirectories not configured with modifier modifiers, Android is recognized as the default resource directory. One exception, however, is the screen display density (drawable resource), which typically has three configuration modifiers:-mdpi-hdpi-xhdpi. The Android system chooses which drawable resource combines screen density and actual size, and may even choose drawable resources below or above the screen density of the current device, and then zoom to achieve the match. But to make a long story short, it's important to remember that res/drawable is not the default resource directory, and we don't need to put the default drawable resources in that directory .
Common Configuration Modifiers
Chinese Language (VALUES-ZH)
Screen orientation for horizontal mode (Layout-land)
Medium screen display density (drawable-mdpi)
API level 11 and above (VALUES-V11)
So what are the device features with configuration modifiers?
for device configuration features and their corresponding configuration modifiers, see http://developer.android.com/guide/topics/resources/providing-resources.html
is also the priority of the configuration modifier, how to understand it? We directly on the example:
Old phone setting: Language (English), screen orientation (vertical)
What we want to do: when changing the language configuration of the phone, the app can also become Chinese, and when the screen orientation becomes horizontal, the title can become another sentence longer. So we did two things: Values-zh (used to store Chinese string resources), Values-land (used to hold the title string when the screen is in the horizontal state)
New phone setting: Language (Chinese). Screen orientation (horizontal)
Here's the question: will Android use that values resource? At this point the configuration modifier priority is shown, and we can see that the priority of the language is higher than the screen orientation, so the system chooses Values-zh instead of Values-land.
The problem knows, how to solve it? The answer is a multi-configuration modifier.
This problem can be solved by Values-zn-land. But we must note that the order is also determined by priority.
The entire configuration modifier is used in this way:
Phone configuration-----(full)----> configuration modifier--(get the corresponding resource)--Complete the change
But for screen density this configuration does not correspond exactly, what does that mean? or example, for example, mobile phone configuration language changed to Chinese, then will and-zh corresponding, but the screen density if is medium, but does not necessarily and-mdpi correspondence, the system will consider the screen density and the actual size of the phone to get the resources due.
The sun rises as usual, and life is lonely as snow.
Localization and knowledge development of android-applications configuration modifiers