[英]Difference between @string and @+string?
Sometimes, when I want to refer a value to a string reference I use @string/blabla, but sometimes, it gives me an error that I can run the code unless i change @string to @+string
What's the difference between them? 有时,当我想将一个值引用到字符串引用时,我使用@ string / blabla,但有时,它会给我一个错误,我可以运行代码,除非我将
@string to @+string
更改@string to @+string
它们之间的区别是什么? Any answer would be so helpful. 任何答案都会非常有帮助。 Thanks in Advance!
提前致谢!
The +
means that this identifier will be added to the resources. +
表示此标识符将添加到资源中。 You declare that it exists somewhere and use it at the same time. 您声明它存在于某处并同时使用它。 Not sure if that really applies to strings but I guess it does.
不确定这是否真的适用于字符串,但我想它确实如此。 It would explain why you get no error.
它可以解释为什么你没有错误。
And I doubt it is good to use a +
to make it work. 而且我怀疑使用
+
来使它工作是好的。 You could end up with a string declaration with no actual string content which will likely result in a crash. 你最终可能会得到一个没有实际字符串内容的字符串声明,这可能会导致崩溃。
If it is not working without the +
try building / refreshing your project. 如果没有
+
尝试构建/刷新您的项目它不工作。 If the string is defined in one of your xml files you should be able to use @string
如果字符串是在您的一个xml文件中定义的,那么您应该能够使用
@string
@String
是从字符串文件中检索到的值。
hey guys use the newest elipse, there's a bit of difference between it and the old ones. 嘿家伙使用最新的elipse,它和旧的elipse有点不同。 I guess zapl's answer is correct, the + sign is to add it to the references.
我猜zapl的答案是正确的,+符号是将它添加到引用。 Cheers guys!
干杯啦!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.