[ACCEPTED]-Highlight on clickablespan click-highlight

Accepted answer
Score: 29

You can override onClick(View widget) like this:

        @Override
        public void onClick(View widget) {
            // do what must happen after click event.
            widget.invalidate();
        }

0

Score: 24

This will remove any highlight.

tv.setHighlightColor(Color.TRANSPARENT);

0

Score: 14

enter image description here

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());

0

Score: 0
<?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>

0

Score: 0

just use this..

view.setSelector(new ColorDrawable(Color.TRANSPARENT));

0

Score: 0

u can replace default highlightColor android:textColorHighlight

    <TextView
    android:id="@+id/tv_tip"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#727998"
    android:textColorHighlight="@android:color/transparent"
    tools:text="@string/_tip" />

or 1 disable focus

More Related questions