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.
Asked
Active
Viewed 58 times
0
Zoe stands with Ukraine
- 25,310
- 18
- 114
- 149
Hadi1986
- 41
- 4
-
Do you use a TextView? – Pouria Hemati Jun 22 '19 at 07:20
-
Please elaborate your question with some code and detailed explanation. – Shubham Panchal Jun 22 '19 at 07:41
-
Have a look at this : [Clickable Span](https://stackoverflow.com/questions/10696986/how-to-set-the-part-of-the-text-view-is-clickable) – isstiaung Jun 22 '19 at 10:34
1 Answers
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
Pradip Vadher
- 158
- 7
-
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