0

I want to create a TextView with underline text . Please suggest me how to create in layout file . Find the image bellow

https://i.stack.imgur.com/4kcTN.png

anu
  • 213
  • 1
  • 3
  • 10

2 Answers2

6

add this line to your code

textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
Joshua
  • 1,167
  • 1
  • 14
  • 32
0
SpannableString spanStr = new SpannableString("Your String");
    spanStr.setSpan(new UnderlineSpan(), 0, spanStr.length(), 0);

yourTextView.setText(spanStr);
Aneeb Khawar
  • 330
  • 1
  • 8