实例:
要使用
Resource res = getResource();
String text = String.format(res.getString(R.string.welcome_message),username,mailCount);
需要在xml中定义
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>
其中 第一个 %1$s 表示一个String
第二个 %2$d 表示一个浮点数
那么在 文件中定义个% 需要 用%% 来表示