参考 https://blog.csdn.net/jayliu1989/article/details/64904442
格式化字符串的几种方法:(看源码)
1.`
public String getString(@StringRes int id) throws NotFoundException {
return getText(id).toString();
}`
tvOffice.setText(String.format(getResources().getString(R.string.office),“text”))
2.推荐此种方法
public String getString(@StringRes int id, Object… formatArgs) throws NotFoundException {
final String raw = getString(id);//实际上还是调用了方法1
return String.format(mResourcesImpl.getConfiguration().getLocales().get(0), raw,
formatArgs);
}
tvOffice.setText(getResources().getString(R.string.office,“text”));