如果是在资源文件里,可以这样写.
Xml代码
<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>
如果是代码这样写
Java代码
TextView textView = (TextView)findViewById(R.id.testView);
textView.setText(Html.fromHtml("<u>"+"hahaha"+"</u>"));
Xml代码
<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>
如果是代码这样写
Java代码
TextView textView = (TextView)findViewById(R.id.testView);
textView.setText(Html.fromHtml("<u>"+"hahaha"+"</u>"));
本文介绍如何在Android应用中使用HTML来格式化显示文本,包括在资源文件中定义带有下划线的字符串和通过Java代码设置TextView的富文本格式。
1163

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



