0

I would like to create a book reader and for this i have a problem of selecting some text and i don't know what is the best way. I read some posts in which they where using EditText for selection. But this is not so usefull because when you long tap it shows select word/select all and the keyboard appears, what i want is only the possibility to select text, listen the selection and then using Spannable/Linkify to edit that portion of text.

If there is no easy thing to use the standard text cursor controllers, can i create a custom cursor controllers or something like that ?

I read this posts:

Select text from TextView?

How to allow the user to select a text range in a TextView (Similar to EditText)

Thank you in advance.

Update:

I found this class android.text.Selection that seems to use the cursor controllers But i don't find any examples on google about it.

Community
  • 1
  • 1
djcharon
  • 319
  • 2
  • 9
  • 20

2 Answers2

1

Use android:textIsSelectable="true" on your TextView.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

I'm made a custom TextView with selection capability by studying Android's source code. Please see my answer from the other question Android- How can I show text selection on textview?

Community
  • 1
  • 1
Ray Zhou
  • 716
  • 10
  • 22