安卓的EditText侦听光标移动 [英] Android: EditText listener for cursor position change

查看:328
本文介绍了安卓的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(SelStart的INT,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)

这篇关于安卓的EditText侦听光标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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