在字符串资源的xml文件中可以添加, HTML 标签 <b></b>
,<i></i>
和<u></u>
.
<resource>
<string name="your_string_here">This is an <u>underline</u>.</string>
</resources>
在代码使用:
TextView textView = (TextView) view.findViewById(R.id.textview);
SpannableString content = new SpannableString("Content");
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
textView.setText(content)
from stackoverflow