<resources>
<string name="s1">\"双引号\"</string>
<string name="s2">string:%1$s</string>
<string name="s3">int:%1$d</string>
<string name="s4">float:%1$2.2f</string>
<string name="s5">混合:name:%1$s,age:%2$d,pai:%3$2.3f</string>
</resources>
tv.setText(getString(R.string.s5,"zhangsan",2,3.8));
主要是记住strings.xml里的特殊格式
原文链接:https://www.f2er.com/xml/294783.html