3

I just want to make some text clickable in TextView, so I used ClickableSpan, but the background color of text is changed when I touched it.

This is my code:

ClickableSpan clickableSpan = new ClickableSpan() {
    @Override
    public void onClick(View widget) {
        // do something
    }
};
SpannableString ss = new SpannableString("ClickableSpan Test");
ss.setSpan(clickableSpan, 0, 13, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

How can I prevent changing background color on touch?

Andrew Kuklewicz
  • 10,621
  • 1
  • 34
  • 42
Lee Jeongmin
  • 793
  • 11
  • 22
  • What color does it start with? What color does it show when clicked? – MiStr Jan 23 '15 at 19:22
  • @Lee Jeongmin my answer is solution for your question then mark it right... – Lokesh Jan 27 '15 at 06:40
  • @Lokesh Yes your answer is solution. But I don't have enough reputation. So I can't do that. When I got a reputation, I will vote up your answer. Thank you again! – Lee Jeongmin Jan 27 '15 at 08:42
  • no man there is a right tick below vote count, please tick on that mark...it also increase your repo as well – Lokesh Jan 27 '15 at 08:56

1 Answers1

4

Add this in you textview

android:textColorHighlight`="#000000"
Lokesh
  • 3,247
  • 2
  • 33
  • 62