0

I want to set clickable for all of my word , Not special word . My app is a kind of Ebook that I want to set method onclick for them , Like translate.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Hadi1986
  • 41
  • 4

1 Answers1

0

read official doc: https://developer.android.com/reference/android/text/style/ClickableSpan

SpannableString string = new SpannableString("Text with clickable text");
string.setSpan(new CustomClickableSpan(), 10, 19,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

Where "clickable" text is clickable

  • OK. I know it . But I want every word can be clickable. I mean , in your example : text , with , clickable and text . All of them . I want to make a story book and it's show translation by click on it . – Hadi1986 Jun 22 '19 at 14:25