android xml 文件中的硬编码字符串有什么问题? [英] what's wrong with hardcoded string in android xml file?
本文介绍了android xml 文件中的硬编码字符串有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢将简单的文本直接放在 xml 文件中,而无需先声明字符串.它更容易,更简单,更少混乱.但是,每当我这样做时,它总是有一个警告标志.
I love to put simple text directly on the xml file without declaring a string first. It is easier, more simple and less messy. However, it always has a warning badge whenever I do so.
如果我的 xml 文件中有几十个硬编码字符串而不考虑警告怎么办?我会遇到麻烦吗?
What if I have a dozens of hardcoded string in my xml file without concerning the warning? Will I get into a trouble?
提前致谢.
推荐答案
不,您不会遇到麻烦,但在您的 xml 中使用 @string/yourString
将是一个很好的做法并且 这将使多语言支持更容易.
No, you will not get into trouble, but using @string/yourString
in your xml will be a good practice and it will make multi-language support easier.
这篇关于android xml 文件中的硬编码字符串有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文