xml字串:
<string name="web_user_agent" translatable="false"><xliff:g id="x">Mozilla/5.0 (Linux; U; Android %s)
AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1</xliff:g></string>
代码:
final String base = mContext.getResources().getText(
com.android.internal.R.string.web_user_agent).toString();
return String.format(base, buffer);
效果:
将buffer字串插入到b_user_agent字串的%s位置。