I have a Spannable Object
with a Clickable Object
set to it. When the Spannable String
is displayed in the TextView
it has bl
This works for me. No need to create custom ClickableSpan
class. Just override updateDrawState(TextPaint ds)
.
SpannableString span = new SpannableString("Some text");
ClickableSpan clickSpan = new ClickableSpan() {
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(ds.linkColor); // you can use custom color
ds.setUnderlineText(false); // this remove the underline
}
@Override
public void onClick(View textView) {
// handle click event
}
};
span.setSpan(clickSpan, 5, span.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
yourTextView.setText(span);