Android:EditText监听器,用于光标位置更改 [英] Android: EditText listener for cursor position change

查看:1369
本文介绍了Android:EditText监听器,用于光标位置更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来检测在中更改的光标位置EditText 。我到目前为止在文档中找不到任何东西。有没有人解决这个问题?

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?

推荐答案

你可以覆盖onSelectionChanged(int selStart,int selEnd)如果光标被移动,这也被调用(在这种情况下是selStart == selEnd)

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)

这篇关于Android:EditText监听器,用于光标位置更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆