可以在Android的字符串资源中包含字符串资源ID

时间:2019-07-22 05:54:22

标签: android android-resources

我的字符串在以下几行中都包含了

<resources>
    <string name="my_name">Android</string>
    <string name="welcome">Hi @string/name welcome !</string>
    <string name="goodbye">Goodbye @string/name. Have a nice day</string>
</<resources>

我的代码如下检索字符串

String welcome = mContext.getResources().getString(R.string.welcome);
String goodbye = mContext.getResources().getString(R.string.goodbye);

我喜欢得到如下输出

Hi Android welcome !
Goodbye Android. Have a nice day

感谢解决方案

0 个答案:

没有答案