[Android] [1] Internationalization of APP desktop icons and display names

foreword

In the next few days, I will publish a series of articles one after another. I originally thought of the title as "A Set of Low Availability, Difficult Scaling, and Low Concurrency Android APP Architecture Design Practice", which is too abstract. Review later.

Prerequisites, two articles:

[CSDN] guolin "Android Application Icon Micro Skills, Adaptation of Application Icons in 8.0 System"

[Blog Garden] Riding a turtle for a walk " Android International Operation "

text:

The above two articles have already summed up very well, but in order to achieve the purpose of phased summary, let’s go through the process again.

Let's talk about how to quickly and efficiently make a set of universal APP Icon, ic_launcher, that is, the icon of your APP on the mobile phone desktop.

Make ic_launcher process

  1. prepare a picture
  2. Copy to the res directory of AndroidStudio, as to whether it is drawable or minmap directory, feel free.
  3. Press the shortcut key Ctrl + Shift + R in AndroidStudio, this is the general shortcut key of IDEA series software: global search.
  4. Select the Actions on the right , and then perform a global search: Image Asset (note that I bolded the words in front of me, otherwise the Image Asset will not be found)
  5. For the foreground, choose a picture and adjust it to a suitable size; for the background, I usually choose a color and adjust it to a more suitable background color.
  6. Next, select the save location (usually the default)
  7. Finish

83936452

5158
After the above steps, you can create a set of App Icons suitable for almost all models

If you want to use it as a desktop icon, you need to specify it in the AndroidManifest.xml file
6112

Localized APP name process

As can be seen from the screenshot above, there is a label="@String/app_name" between icon and roundIcon, which is where the name of our App is configured to be displayed on the mobile phone desktop.

Ctrl+click app_name to view the source file

Modify it to the name you want to display, I'll call it a test here

5359
This file cannot change with the system voice. To achieve localization, for example, I want to localize Simplified Chinese and American English. Then I create two directories under the res directory: values-zh-rCN and values-en-rUS (note that Android uses it uncharacteristically here — dashes instead of underscores —). Then create strings.xml files in them respectively. If you see a small flag in front of the file name, it means the creation is correct. Otherwise, check to see if the directory is wrong. For example, it should be an underscore but it is written as an underline, or the directory you created cannot refer to on behalf of any country.
09617953 3615

After the work is done, run it, change the settings-system-language to English, and check whether the app name is localized successfully.

7551
This article is over!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326038313&siteId=291194637