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基础知识要点
MQ.dubbo.SpringCloud 1) 集合框架 2)线程 3)IO流 4)类和对象生命周期 5)JAVA的反射机制 6) JVM 7)数据结构和常用算法 8)设计模式 9)网络编程
- Spring3.2.3+Quartz2.2.1 整合配置
步骤: 1.下载相关包 quartz-2.2.1.jar quartz-jobs-2.2.1.jar spring相关jar包 2.编写配置文件静态 <bean id="activat ...
- [Android Pro] Android源码编译后,再重编译所需要做的清理工作
1.在源码目录的根目录下,make clean; 2.进到源码的\linux\kernel\目录下,执行make mrproper: 3.再退回到根目录,执行source build/envsetu ...
- C语言:内存的分配与管理
1.内存区域的划分标准: 代码段 存储代码 数据段 静态/全局数据.常量(const) 堆区(heap) 动态内存分配(更 ...
- Android消息通知-Notification
Android中常用的消息提醒,一种是Toast弹出提醒内容,一种是AlterDialog弹出框来提醒用户,还有一种就是消息通知的,用Android经常收到各种通知就是Notifation.Notif ...
- idea unicode自动转码设置
idea unicode自动转码设置 File > Settings > Editor > File Encodings 右侧 Properties Files 中 选中 Trans ...
- PREEMPT_RT的未来
因为开发资金的问题,Thomas Gleixner宣布他已经不想干了. 商业公司往往用了PREEMPT_RT的功能去不愿意去回报社区,那就自己弄吧. http://lwn.net/Articles/6 ...
- [Javascript]Clouse Cove, 2 ,Modifying Bound Values After Closure
function buildCoveTicketMarker(transport){ var passengerNumber = 0; return function(name){ passenger ...
- python使用md5处理下载图片
import urllib2 import hashlib opener = urllib2.build_opener() req = opener.open("http://avatar. ...
- 【Flash 插件】时钟类插件
1.honehone_clock人体时钟实现 原理:就是在网页上播放已写好的.SWF文件. 效果如下: 效果一:背景透明,推荐为白色或浅背景 效果二:背景白色,推荐黑色或深色背景 实现步骤: 先引用 ...