当用户在其中包含文本时,如果用户从shelfnumberbox中输入/ next / ready,我将如何激活btn_aprove
shelfnumberbox.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
btn_aprove.performClick();
}
});
答案 0 :(得分:0)
试试这个:
shelfnumberbox.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_DONE){
btn_aprove.performClick();
}
return false;
}
});