如何在textview上设置下划线文本? [英] How to set underline text on textview?
本文介绍了如何在textview上设置下划线文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在textview
上设置下划线文字?
How to set underline text on textview
?
我使用了以下代码,但它不起作用.
I have used following code but it is not working.
tvHide.setText(Html.fromHtml("<p><u>Hide post</u></p>").toString());
推荐答案
你必须使用 SpannableString :
String mystring=new String("Hello.....");
SpannableString content = new SpannableString(mystring);
content.setSpan(new UnderlineSpan(), 0, mystring.length(), 0);
yourtextview.setText(content);
更新:您可以参考我对 Underling TextView 的回答 这里 以所有可能的方式.
Update : You can refer my answer on Underling TextView's here in all possible ways.
这篇关于如何在textview上设置下划线文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文