Text selection listener in Android(API level 7)

后端 未结 2 638
终归单人心
终归单人心 2020-12-22 10:52

I need a listener which is called every time the selection in an EditText changes. I googled around but I couldn\'t find anything useful for API level 7. I\'m writing a Text

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 11:16

    The better way to do it would be to extend the EditText and then based upon how you would want to manage the changing text, you could override one of the 2 methods to work out your customized behavior.

    1. If you want the selection changed then you could use the onSelectionChanged() method and implement your code there.

    2. In case you want to implement something when the text changes in your editor then you could use, onTextChanged().

提交回复
热议问题