android edittext onchange listener

前端 未结 9 2194
长情又很酷
长情又很酷 2020-11-27 13:28

I know a little bit about TextWatcher but that fires on every character you enter. I want a listener that fires whenever the user finishes editing. Is it possib

9条回答
  •  眼角桃花
    2020-11-27 13:48

     myTextBox.addTextChangedListener(new TextWatcher() {  
    
        public void afterTextChanged(Editable s) {}  
    
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {} 
    
        public void onTextChanged(CharSequence s, int start, int before, int count) {  
    
        TextView myOutputBox = (TextView) findViewById(R.id.myOutputBox);  
        myOutputBox.setText(s);  
    
        }  
    });  
    

提交回复
热议问题