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 });

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM