Can underline words in TextView text

前端 未结 5 1453
野趣味
野趣味 2021-02-02 09:45

Is there possibility in android to provide TextView some text in Java code with setText(text) function with basic tags like and to make marked words underlined ?

5条回答
  •  时光取名叫无心
    2021-02-02 10:32

    You can use UnderlineSpan from SpannableString class:

    SpannableString content = new SpannableString();
    content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
    

    Then just use textView.setText(content);

提交回复
热议问题