android EditText监听事件及参数详解

 1 editText.addTextChangedListener(new TextWatcher() {
 2     @Override
 3        public void onTextChanged(CharSequence text, int start, int before, int count) { 
 4        //text  输入框中改变后的字符串信息 
 5        //start 输入框中改变后的字符串的起始位置 
 6        //before 输入框中改变前的字符串的位置 默认为0 
 7        //count 输入框中改变后的一共输入字符串的数量 
 8             
 9        } 
10             
11        @Override
12        public void beforeTextChanged(CharSequence text, int start, int count,int after) { 
13        //text  输入框中改变前的字符串信息 
14        //start 输入框中改变前的字符串的起始位置 
15        //count 输入框中改变前后的字符串改变数量一般为0 
16        //after 输入框中改变后的字符串与起始位置的偏移量 
17           
18        } 
19             
20        @Override
21        public void afterTextChanged(Editable edit) { 
22        //edit  输入结束呈现在输入框中的信息 
23          
24        } 
25 });

 

posted on 2014-01-20 11:11  凡人柯  阅读(8361)  评论(0编辑  收藏  举报