ClickableSpan - How to remove color on text when added?

2.2k views Asked by At

I've used ClickableSpan on a TextView. Upon adding the span, the color of text where it has been applied was changed too.

Checking SO questions, what I've seen are changed color after it was clicked. In my case, the color is already different upon rendering the view.

How can I remove the color from the ClickableSpan?

1

There are 1 answers

0
Wasim K. Memon On BEST ANSWER

Clickable span have updateDrawState(TextPaint ds) method. set same color as you text color for clickable span also. so it will look same (2nd Approch)

@Override public void updateDrawState(TextPaint ds) {
    //super.updateDrawState(ds);
    ds.setColor(linkColor);
    ds.setUnderlineText(false); // set to false to remove underline
}