Skip to content

Instantly share code, notes, and snippets.

@androidcodehunter
Created October 13, 2016 05:31
Show Gist options
  • Save androidcodehunter/fdd4efc1cbb3b5c9deb69f3cb0dca727 to your computer and use it in GitHub Desktop.
Save androidcodehunter/fdd4efc1cbb3b5c9deb69f3cb0dca727 to your computer and use it in GitHub Desktop.
Removing highlighted color from ClickableSpan in Android
I’ve been struggling for some hours with TextView and Spannable.. ClickableSpan to be precise. It seems that when you tap the clickable text it gets an ugly orange stroke (might differ on devices) around the text and if you so happen to have this in a custom view as an item in e.g Gallery it really stands out by highlighting it everytime you scroll away from that view. Annoying, yes?
The solution is extremely simple and was provided by a thread over at Stackoverflow.com.
To edit or remove the higlight color you can simply set the TextViews highlight color itself to any color you want or Color.TRANSPARENT if you don’t want any color.
android:textColorHighlight="@color/something"
or in code
textView.setHighlightColor(Color.TRANSPARENT);
@SerendipityMatthew
Copy link

you save my life

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment