在strings.xml文件中定义:
<string name="welcome_messages">你好, %1$s! 是第 %2$d 个人.</string>
在java文件中这么写
TextView textView = (TextView) findViewById(R.id.t);
textView.setText(String.format(getResources().getString(R.string.welcome_messages),"heji",1));
<string name="welcome">Welcome to <u><i>Android</i></u>!</string>
<u></u>有下划线
<i></i>斜体字
<b></b>加粗
<string name="tagged_string">
Hello <b><i>heji</i></b>, loverui.
</string>
Html.fromHtml(getResources().getString(R.string.tagged_string))
[img]http://dl.iteye.com/upload/attachment/270173/1289cd13-a60c-3e22-9d8f-49d18e8648da.png[/img]
[img]http://dl.iteye.com/upload/attachment/282542/8e272963-5ca4-39c7-96e2-e0ea6cf8f668.png[/img]