Draw an Underline below the TextView in Android


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

2nd Approach

You can make use of setPaintFlags method of TextView to underline the text of TextView.

For eg.

You can refer constants of Paint class if you want to strike thru the text.

3rd Approach

Make use of Html.fromHtml(htmlString);