%1$s %1$d string

  <string name="time">我的时间:&#160;%1$s</string>
String times= getResources().getString(R.string.time);  
String sFinalAge = String.format(times, "xx年xx月");  

也可简单写成:

%d   (表示整数)

%f    (表示浮点数)

%s   (表示字符串)

猜你喜欢

转载自zxuenet.iteye.com/blog/2294379