如何设置下划线上的TextView文本? [英] How to set underline text on textview?

查看:124
本文介绍了如何设置下划线上的TextView文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何身体的想法有关,如何设置下划线上的TextView文本? 如果有,请告诉我们。

Any body idea about that , How to set underline text on textview? if yes, please tell.

我用下面的code,但它不工作。

i have used following code but its 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);

更新:你可以参考我的上下属的TextView的<一个答案href="http://stackoverflow.com/questions/8033316/to-draw-an-underline-below-the-textview-in-android/8033336#8033336">here在所有可能的方式。

Update : You can refer my answer on Underling TextView's here in all possible ways.

这篇关于如何设置下划线上的TextView文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆