How to get rid of the underline in a Spannable String with a Clickable Object?

后端 未结 10 2018
陌清茗
陌清茗 2021-02-03 16:44

I have a Spannable Object with a Clickable Object set to it. When the Spannable String is displayed in the TextView it has bl

10条回答
  •  野的像风
    2021-02-03 17:13

    Based on the answer of @Sai Gopi Me

    in Kotlin:

    val clickableSpan: ClickableSpan = object : ClickableSpan() {
        override fun onClick(widget: View) {
            // some action here
        }
                    
        override fun updateDrawState(ds: TextPaint) {
            super.updateDrawState(ds)
            ds.isUnderlineText = false
            }
        }
    }
    

提交回复
热议问题