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 c
just use this..
view.setSelector(new ColorDrawable(Color.TRANSPARENT));
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_height="50px"
android:layout_width="fill_parent"
// Layout Click enable
android:clickable="true"
// Setting Highlight Option in background property
android:background="@android:drawable/list_selector_background" />
</LinearLayout>
</LinearLayout>
textView.setText(myString);
Linkify.addLinks(textView,Linkify.ALL);
This works for me.
You can override onClick(View widget)
like this:
@Override
public void onClick(View widget) {
// do what must happen after click event.
widget.invalidate();
}
ClickableSpan linkClick = new ClickableSpan() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "Link Click",
Toast.LENGTH_SHORT).show();
view.invalidate();
}
@Override
public void updateDrawState(TextPaint ds) {
if (textView.isPressed()) {
ds.setColor(Color.BLUE);
} else {
ds.setColor(Color.RED);
}
textView.invalidate();
}
};
textView.setHighlightColor(Color.TRANSPARENT);
Spannable spannableString = new SpannableString("Link in TextView");
spannableString.setSpan(linkClick, 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(spannableString, TextView.BufferType.SPANNABLE);
textView.setMovementMethod(LinkMovementMethod.getInstance());
This will remove any highlight.
tv.setHighlightColor(Color.TRANSPARENT);