我想在字符串“confirm_msg”中添加金额
final int colorGreen = getResources().getColor(R.color.green_dark);
SpannableString spannable = new SpannableString("$" +amount);
spannable.setSpan(new ForegroundColorSpan(colorGreen), 0, ("$" + amount).length(), 0);
txtConfirmMSG.setText(getString(R.string.confirm_msg, spannable));
这是 xml 中的字符串:
<string name="confirm_msg">PLEASE CONFIRM THAT YOU WISH TO SEND A %1$s </string>