如果是在资源文件里,可以这样写.
- < resources >
- < string name = "hello" > < u > phone: 1390123456 </ u > </ string >
- < string name = "app_name" > MyLink </ string >
- </ resources >
<resources>
<string name="hello"><u>phone: 1390123456</u></string>
<string name="app_name">MyLink</string>
</resources>
如果是代码这样写
- TextView textView = (TextView)findViewById(R.id.testView);
-
textView.setText(Html.fromHtml("<u>"
+
"hahaha"
+
"</u>"
));
本文介绍如何在Android应用中使用HTML标签来格式化TextView显示的文本内容,包括资源文件中的字符串定义及Java代码实现。

被折叠的 条评论
为什么被折叠?



