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 ...
随机推荐
- 正则表达式校验15/18位生份证-JAVA版
public static boolean isIDNumber(String iDNumber) { if (iDNumber == null || "".equals(iDNu ...
- 【spring cloud】在spring cloud服务中,打包ms-core失败,报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project
在spring cloud服务中,有一个ms-code项目,只为所有的微服务提供核心依赖和工具类,没有业务意义,作为核心依赖使用.所以没有main方法,没有启动类. 在spring cloud整体打包 ...
- myeclipse 修改freemarker ftl 不重启tomcat
最 近的项目是SSH,View层采用Freemarker,但是遇到了一个很大问题,每次修改完ftl文件,都要重新启动tomcat才可以看到所修改的内 容,不但麻烦,而且浪费时间,特别怀念jsp,后来在 ...
- UITableView分页
UITableView分页上拉加载简单,ARC环境,源码如下,以作备份: 原理是,点击最后一个cell,触发一个事件来处理数据,然后reloadData RootViewController.m + ...
- 结合MapReduce和数据集Combining datasets with MapReduce
While in the SQL-world is very easy combining two or more datasets - we just need to use the JOIN ke ...
- Python for everyone chapter 1
Chapter 1 10 试题 1. When Python is running in the interactive mode and displaying the chevron prompt ...
- Java IO 体系结构
参考文章地址: http://blog.csdn.net/oracle_microsoft/article/details/2634231 Java IO体系结构看似庞大复杂,其实有规律可循,要弄清楚 ...
- C语言数字与字符串转换 atoi()函数、itoa()函数、sprintf()函数
在编程中经常需要用到数字与字符串的转换,下面就总结一下. 1.atoi() C/C++标准库函数,用于字符串到整数的转换. 函数原型:int atoi (const char * str); #inc ...
- C# WinForm开发系列 - GDI+【转】
http://blog.csdn.net/blue_sky6/article/details/53811435?locationNum=6&fps=1 C# WinForm开发系列 - GDI ...
- OpenProcess、GetExitCodeProcess、TerminateProcess
//声明: {返回进程的句柄} OpenProcess( dwDesiredAccess: DWORD; {訪问选项} bInheritHandle: BOOL; {是否能继承; Tr ...