android API之android.text.TextWatcher
When an object of a type is attached to an Editable, its methods will be called when the text is changed.
接口TextWatcher定义了三个抽象方法:
public void beforeTextChanged(CharSequence s, int start, int count, int after)
This method is called to notify you that, within s
, the count
characters beginning at start
are about to be replaced by new text with length after
. It is an error to attempt to make changes to s
from this callback.
public void onTextChanged(CharSequence s, int start, int before, int count)
This method is called to notify you that, within s
, the count
characters beginning at start
have just replaced old text that had length before
. It is an error to attempt to make changes to s
from this callback.
public void afterTextChanged(Editable s)
This method is called to notify you that, somewhere within s
, the text has been changed. It is legitimate(合理) to make further changes to s
from this callback, but be careful not to get yourself into an infinite loop, because any changes you make will cause this method to be called again recursively(递归). (You are not told where the change took place because other afterTextChanged() methods may already have made other changes and invalidated the offsets. But if you need to know here, you can use Spannable.setSpan
in onTextChanged
to mark your place and then look up from here where the span ended up.
android API之android.text.TextWatcher的更多相关文章
- 【Android API】Android 4.1 API官方文档详解
原文:http://android.eoe.cn/topic/summary 翻译:[eoeAndroid原创团队]kris.流风而逝.贼寇在何方.snowxwyo.lsy4833406 更新日期:2 ...
- Android API之android.content.BroadcastReceiver
android.content.BroadcastReceiver Base class for code that will receive intents sent by sendBroadcas ...
- Android API之android.provider.ContactsContract.RawContacts
android.provider.ContactsContract.RawContacts Constants for the raw contacts table, which contains o ...
- Android API之android.provider.ContactsContract
android.provider.ContactsContract ContactsContract是联系人provider和app的contract.定义了已支持的URL和column.取代了之前的 ...
- Android API之android.os.Parcelable
android.os.Parcelable Interface for classes whose instances can be written to and restored from a Pa ...
- Android API之android.os.AsyncTask
android.os.AsyncTask<Params, Progress, Result> AsyncTask enables proper and easy use of the UI ...
- Android API之android.widget.Filterable
android.widget.Filterable 定义了一种可过滤的行为.Filterable接口通常有android.widget.Adapter来实现.接口Filterable中有个抽象方法 ...
- Android API之android.content.AsyncQueryHandler
android.content.AsyncQueryHandler A helper class to help make handling asynchronous ContentResolver ...
- Android API之android.provider.ContactsContract.Data
android.provider.ContactsContract.Data Constants for the data table, which contains data points tied ...
随机推荐
- 推荐Java程序员阅读的书籍(转)
作为Java程序员来说,最痛苦的事情莫过于可以选择的范围太广,可以读的书太多,往往容易无所适从.我想就我自己读过的技术书籍中挑选出来一些,按照学习的先后顺序,推荐给大家,特别是那些想不断提高自己技术水 ...
- Gunicorn+Flask中重复启动后台线程问题
假设程序如下: if __name__ == '__main__': t = Thread(target=test) t.start() app.run(host='0.0.0.0',port=808 ...
- 认识Mac中的那些符号
今天看到这篇文章,讲了Mac中的各种符号,还是很不错的. http://www.cnblogs.com/jimcheng/articles/4156268.html
- Tomcat安装笔记(on Mac)
1. 官网 http://tomcat.apache.org/ 下载apache包,我下的8.5 注意要下core包的tgz版本,我开始下了full doc. 2. 拷贝解压到 /Library, 然 ...
- [leetcode]Populating Next Right Pointers in Each Node @ Python
原题地址:https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/ 题意: 1 / \ 2 3 / \ ...
- HTML标签 闭合还是不闭合?
你在写 HTML5 代码的时候,是否纠结过应该写 <br /> 还是 <br>,是写 <input /> 还是写 <input>.写 <scrip ...
- SQL Server 视图索引
在视图上创建索引的另一个好处是:查询优化器开始在查询中使用视图索引,而不是直接在 FROM 子句中命令视图.这样一来,可从索引视图检索数据而无需重新编码,由此带来的高效率也使现有查询获益.在视图上创建 ...
- BSTR
BSTR A BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, a ...
- Cocos2d-x 3.0多线程异步资源载入代码
// AppDelegate.cpp bool AppDelegate::applicationDidFinishLaunching() { - - FlashScene* scene = Flash ...
- mysql命令的一些参数
一mysql命令行参数 Usage: mysql [OPTIONS] [database] //命令方式 -?, --help //显示帮助信息并退出 -I, --help //显示帮助信息并退出 - ...