可能重複:
How can I create a multilingual android application?Android:我怎樣才能讓我的應用程序多語言?
我創建的應用程序,我在測試階段,但我想我的應用程序多國語言。
我怎樣才能使它多語言? 製作它的最佳方法是什麼?
可能重複:
How can I create a multilingual android application?Android:我怎樣才能讓我的應用程序多語言?
我創建的應用程序,我在測試階段,但我想我的應用程序多國語言。
我怎樣才能使它多語言? 製作它的最佳方法是什麼?
你需要做的是在res
文件夾中創建新文件夾。
例子:如果你需要支持添加到西班牙和意大利,你需要做的是這樣的:
res文件夾
1.1值
1.2值-ES //西班牙語
1.3的值,它//意大利
之後,您需要在values-es
和values-it
中創建string.xml
文件。而在所有的文件,你只需要創建要使用這樣所有的字符串:
<string name="title">Title</string> // in values folder
<string name="title">Title in Spanish</string> // in values-es folder
and etc.
之後,你可以使用這些字符串:
TextView text = (TextView) findViewById(R.id.textView);
text.setText(getString(R.string.title));
這應該工作。
查看本教程有關本地化應用程序:http://developer.android.com/resources/tutorials/localization/index.html。
也許它有幫助。
有很多例子可以幫助您在android中創建多語言應用程序。
對這些文章一看:
http://developer.android.com/resources/tutorials/localization/index.html
http://www.icanlocalize.com/site/tutorials/android-application-localization-tutorial/
這將幫助你創造的Android應用程序多種語言。