<tfoot id='Jw2Z0'></tfoot>
  • <i id='Jw2Z0'><tr id='Jw2Z0'><dt id='Jw2Z0'><q id='Jw2Z0'><span id='Jw2Z0'><b id='Jw2Z0'><form id='Jw2Z0'><ins id='Jw2Z0'></ins><ul id='Jw2Z0'></ul><sub id='Jw2Z0'></sub></form><legend id='Jw2Z0'></legend><bdo id='Jw2Z0'><pre id='Jw2Z0'><center id='Jw2Z0'></center></pre></bdo></b><th id='Jw2Z0'></th></span></q></dt></tr></i><div id='Jw2Z0'><tfoot id='Jw2Z0'></tfoot><dl id='Jw2Z0'><fieldset id='Jw2Z0'></fieldset></dl></div>

        <bdo id='Jw2Z0'></bdo><ul id='Jw2Z0'></ul>
    1. <small id='Jw2Z0'></small><noframes id='Jw2Z0'>

      1. <legend id='Jw2Z0'><style id='Jw2Z0'><dir id='Jw2Z0'><q id='Jw2Z0'></q></dir></style></legend>

      2. 如何更改应用程序的语言

        时间:2023-09-12

        <legend id='mqlo5'><style id='mqlo5'><dir id='mqlo5'><q id='mqlo5'></q></dir></style></legend>
          <bdo id='mqlo5'></bdo><ul id='mqlo5'></ul>

              <small id='mqlo5'></small><noframes id='mqlo5'>

                <i id='mqlo5'><tr id='mqlo5'><dt id='mqlo5'><q id='mqlo5'><span id='mqlo5'><b id='mqlo5'><form id='mqlo5'><ins id='mqlo5'></ins><ul id='mqlo5'></ul><sub id='mqlo5'></sub></form><legend id='mqlo5'></legend><bdo id='mqlo5'><pre id='mqlo5'><center id='mqlo5'></center></pre></bdo></b><th id='mqlo5'></th></span></q></dt></tr></i><div id='mqlo5'><tfoot id='mqlo5'></tfoot><dl id='mqlo5'><fieldset id='mqlo5'></fieldset></dl></div>
                  <tbody id='mqlo5'></tbody>
                <tfoot id='mqlo5'></tfoot>

                • 本文介绍了如何更改应用程序的语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能重复:
                  在 Android 中以编程方式更改语言

                  我是 Android 新手.在我的应用程序中,用户可以从三种语言中选择一种语言.根据用户选择的语言,应该改变整个应用程序的语言.我该怎么做?

                  I am new to Android. In my application user can select a language from three languages. Based on the language selected by user, the entire application's language should be change. How can I do this?

                  推荐答案

                  使用它以编程方式更改语言:

                  Use this to change the language programmatically:

                  Locale locale = new Locale("en_US"); 
                  Locale.setDefault(locale);
                  Configuration config = new Configuration();
                  config.locale = locale;
                  context.getApplicationContext().getResources().updateConfiguration(config, null);
                  

                  写下该语言的国家代码来代替您想要的任何语言的 "en_US".例如,对于日语,ja_JP;对于阿拉伯语,ar.检查 此链接 获取列表.

                  Write the country code of the language in place of "en_US" for whatever language you want. For example, for Japanese, ja_JP; for Arabic, ar. Check this link for a list.

                  res/values-ja 中创建一个文件夹用于日语或 res/values-ar 用于阿拉伯语..

                  And make a folder in res/values-ja for Japanese or res/values-ar for Arabic..

                  并制作一个 string.xml 文件,并在布局上放置您想要的任何语言.它将从 values 文件夹中获取默认语言,否则如果您需要手动获取,它将从您的外部文件夹 values-ar 等中获取.

                  And make a string.xml file, and put whatever languages you want on your layout. It will fetch the default language from values folder otherwise if you want it manually, then it will fetch from your external folder values-ar, etc.

                  res/values-ar 的例子,用于阿拉伯语:

                  An example of res/values-ar for Arabic:

                  <?xml version="1.0" encoding="UTF-8"?>
                    <resources>
                      <string name="label"></string>
                      <string name="name"></string> 
                      <string name="search"> :</string>
                   </resource>
                  

                  这篇关于如何更改应用程序的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:NSLocale currentLocale 总是返回“en_US";不是用户当前的语言 下一篇:如何在Android中获取文本方向并根据方向动态更改布局?

                  相关文章

                • <legend id='IwSwt'><style id='IwSwt'><dir id='IwSwt'><q id='IwSwt'></q></dir></style></legend>

                • <tfoot id='IwSwt'></tfoot>

                    <i id='IwSwt'><tr id='IwSwt'><dt id='IwSwt'><q id='IwSwt'><span id='IwSwt'><b id='IwSwt'><form id='IwSwt'><ins id='IwSwt'></ins><ul id='IwSwt'></ul><sub id='IwSwt'></sub></form><legend id='IwSwt'></legend><bdo id='IwSwt'><pre id='IwSwt'><center id='IwSwt'></center></pre></bdo></b><th id='IwSwt'></th></span></q></dt></tr></i><div id='IwSwt'><tfoot id='IwSwt'></tfoot><dl id='IwSwt'><fieldset id='IwSwt'></fieldset></dl></div>

                    <small id='IwSwt'></small><noframes id='IwSwt'>

                        <bdo id='IwSwt'></bdo><ul id='IwSwt'></ul>