Tell me more ×  I want to draw the underline below my TextView.
I have searched a few content but couldn't find out anything
fruitful.  Can anyone please help me out here?  share|improve
this question add comment  2 Answers  up vote 50 down vote
accepted  There are three ways of underling the text in
TextView.    1. SpannableString    2. setPaintFlags(); of
TextView    3. Html.fromHtml();  Let me explain you all
approaches :  1st Approach  For underling the text in TextView
you have to use SpannableString  String udata="Underlined Text";
SpannableString content = new SpannableString(udata);
content.setSpan(new UnderlineSpan(), 0, udata.length(), 0);  2nd
Approach  You can make use of setPaintFlags method of TextView
to underline the text of TextView.  For eg.
mTextView.setPaintFlags(mTextView.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG); mTextView.setText("This text will be
underlined");  You can refer constants of Paint class if you
want to strike thru the text.  3rd Approach  Make use of
Html.fromHtml(html