【问题标题】:How to underline the text from a string?如何为字符串中的文本添加下划线?
【发布时间】:2019-03-19 03:35:27
【问题描述】:

SpannableString 和 html 标签不适用于最新版本的 android studio。这是我第一次来安卓工作室。提前致谢。

【问题讨论】:

标签: android html spannablestring


【解决方案1】:

TextView中实现文字下划线的方法有很多种

   1- textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

   2- SpannableString strText = new SpannableString("Your Text here");
        strText.setSpan(new UnderlineSpan(),6 , 11, 0);
        textView.setText(strText);

   3- in xml <u> Link Text</u>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-17
    • 2021-05-11
    • 2012-04-18
    • 2011-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    相关资源
    最近更新 更多