捕获Android文本输入框的软键盘完成(Done)按键消息

 

mEditText.setOnEditorActionListener(new EditText.OnEditorActionListener() {

    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
			
            doSomething();
			
            return true;  
        }
        return false;
    }
	
});


 

你可能感兴趣的:(android,service,action)