可以将 strings.xml 中已存在的字符串与当前字符串连接起来。
那就是:如果我有
<string name="hello">hello</string>
我想创建一个具有以下格式的新字符串"Your android says "+hello
恐怕这是不可能的strings.xml
.
您可以做的是使用以下命令以编程方式创建最终字符串getString https://developer.android.com/reference/android/content/Context.html#getString(int):
String outStr = getString(R.string.your_android_says) +
" " + getString(R.string.hello);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)