ANDROID: What is the main idea behind of using strings.xml?

后端 未结 2 740
不知归路
不知归路 2021-01-18 23:54

Someone please explain what is the main idea of using strings.xml? I think it would be useful for multi-language support but how can we organise it for that

2条回答
  •  攒了一身酷
    2021-01-19 00:28

    The idea is that it represents a single location for various strings, so your code isn't peppered with string literals. In addition to that, you gain the ability to easily localize. Organization of files for localization is covered here:

    http://developer.android.com/guide/topics/resources/localization.html#creating-alternatives

    Do you need it if you're not localizing? No. But it may make things easier in the long run, and I would recommend using it just for that reason.

提交回复
热议问题