Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickableSpan - How to remove color on text when added?

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?

like image 370
sticky Avatar asked May 18 '17 16:05

sticky


1 Answers

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
}
like image 138
Wasim K. Memon Avatar answered Oct 09 '22 16:10

Wasim K. Memon