I've got little problem, i need to remove or customize this orange highlight during clicking on clickablespan. This is my class extending ClickableSpan
public class InternalClickableSpan extends ClickableSpan { private String clicked; @Override public void updateDrawState(TextPaint ds) { ds.setUnderlineText(false); } public InternalClickableSpan(String clickedString) { clicked = clickedString; } @Override public void onClick(View view) { Selection.setSelection((Spannable) ((TextView)view).getText(), 0); Toast toast = Toast.makeText(mContext, clicked, Toast.LENGTH_SHORT); toast.show(); } }
and this is how i use it on text view
Spannable spans = (Spannable) tv.getText(); spans.setSpan(new InternalClickableSpan(contacts[i]), text.indexOf(contacts[i]), text.indexOf(contacts[i])+contacts[i].length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Does anybody know how to customize "onclick highlight" on spannable object?
edit: Thanks Aleadam for response, i'am overriding updateDrawState (please take a look at the first method in my InternalClickableSpan class), but i can't find a way to customize this higlight anyway. Has anybody got other ideas? Thanks
You can override onClick(View widget)
like this:
@Override public void onClick(View widget) { // do what must happen after click event. widget.invalidate(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With