Android: EditText listener for cursor position cha

2019-06-12 07:11发布

问题:

This question already has an answer here:

  • Android EditText listener for cursor position change 7 answers

I'm looking for a way to detect a cursor position changed in an EditText. I couldn't find anything in the documentation so far. Has anyone solved this already?

回答1:

You can override onSelectionChanged (int selStart, int selEnd) to get notified about selection changes. If the cursor is moved, this is called as well (in this case selStart == selEnd)