Android multi-language

Source: Internet
Author: User

After an android project is created, the default res Directory includes layout, values, drawable, and so on.

These are the default resource file directories of the program. To implement the multi-language version, we need to add the corresponding resource files for the implementation language.

First, click the Add Android XML file button to display the following interface:

Input File Name: String. XML, select the values single region, add the region in the left list to the list on the left, and enterCN, such

 

At this time, the above message prompts: If region is used, you need to use the language item. Like region, we add the language to the list on the right, and fill inZH, such

 

 

 

Click Finish. The resource file is created. Directory: Res/Values-ZH-RCN (In fact, the above operations are to generate this directory.)

The default string. XML code:

<?xml version="1.0" encoding="utf-8"?><resources><string name="hello">Hello World, Test!</string><string name="app_name">Test-Multilingual</string></resources>

Modify the string. XML in the generated Res/Values-ZH-RCN directory:

<? XML version = "1.0" encoding = "UTF-8"?> <Resources> <string name = "app_name"> test multiple languages </string> <string name = "hello"> multi-language test </string> </resources>

Because the region is set to CN, the Res/Values-ZH-RTW directory is not found during ZH-TW, and the string. xml under the default Res/values directory is loaded.

 

Here, we only use values as an example. You can use other resources, images, and la S.

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.