我想知道是否可以将默认的Android操作系统语言更改为其他语言.例如,语言不在设置中:如何以编程方式将设备的语言设置为缅甸语.
Hul*_*ulk 14
使用它来通过编程方式更改语言 -
Locale locale = new Locale("en_US");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
context.getApplicationContext().getResources().updateConfiguration(config, null);
Run Code Online (Sandbox Code Playgroud)
写下语言的国家代码代替"en_US"你想要的任何语言...比如日语 - "ja_JP"阿拉伯语 - "ar"或查看此链接获取国家代码 -
http://code.google.com/apis/igoogle/docs/i18n.html
并在res/values-ja中为日语创建一个文件夹,在res / values-ar中为阿拉伯语创建一个文件夹.
并制作string.xml文件并将您想要的语言放在您的布局上.它将从values文件夹中获取默认语言,否则您需要手动然后它将从您的外部文件夹值-ar等获取...
它的res/values-ar为阿拉伯语的例子-
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="spinner_label">????? ???</string>
<string name="app_name">2011 ???</string>
<string name="search">??? :</string>
</resource>
Run Code Online (Sandbox Code Playgroud)
希望它会帮助你..
| 归档时间: |
|
| 查看次数: |
14089 次 |
| 最近记录: |