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 ...
随机推荐
- ProGuard使用简介
我们做java开发的一般都会遇到如何保护我们开发的代码问题.java语言由于是基于jvm上面,所以反编译class 文件很很容易.假如我们做了一个web程序,并把这个web程序发布给客户.实际上,客户 ...
- Android只播放gif动画
使用easygifanimator软件把gif动画打散为图片. 第一步:先上图片素材,以下素材放到res/drawable目录下: 转:http://blog.csdn.net/aminfo/arti ...
- Python Post img
from poster.encode import multipart_encode from poster.streaminghttp import register_openers import ...
- Eclipse中运行Tomcat遇到的内存溢出错误
使用Eclipse(版本Indigo 3.7)调试Java项目的时候,遇到了下面的错误: Exception in thread "main" Java.lang.OutOfMem ...
- Matlab注释多行和取消多行注释的快捷键
matlab里注释符号是%,只是单行注释,可是没有多行注释符号,就像C/C++/Java中都有多行注释符号/* */. 如果利用单行注释的方式手工注释一段程序会很麻烦,matlab软件自带快捷键支持 ...
- 编译打包工具sbt的镜像设置
sbt可以和maven共用一个镜像,公司内部有的自然最后不过 创建文件:~/.sbt/repositories [repositories] local aliyun: http://maven.al ...
- SXH232摄像头使用示范
It occurred to me suddenly that I wanted to program the our camera sensor for PC desktop, just like ...
- android:Activity四种启动模式简单介绍
Activity启动模式 能够依据实际的需求为Activity设置相应的启动模式,从而能够避免创建大量反复的Activity等问题 Activity有四种载入模式 1.standard(默认启动模式, ...
- Ubuntu 常用命令大全
Ubuntu 常用命令大全查看软件 xxx 安装内容#dpkg -L xxx查找软件#apt-cache search 正则表达式查找文件属于哪个包#dpkg -S filename apt-file ...
- 第一章 EL表达式常见用法
el最常用的几种使用场景: 从配置文件中读取属性 缺失值情况下,配置默认值 el内部字符串使用String的方法 三目运算符 正则表达式 注入系统属性(system properties) 调用系统原 ...