在TextView.OnEditorActionListener中的解释,EditorInfo.IME_NULL代表enter键被按下,同时判断KeyEvent.ACTION_UP是为了在按下并且松开后做出反应,避免误操作。public abstract boolean onEditorAction (TextView v, int actionId, KeyEvent event) Since: API Level 3Called when an action is being performed. Parameters v The view that was clicked. actionId Identifier of the action. This will be either the identifier you supplied, or EditorInfo.IME_NULL if being called due to the enter key being pressed. event If triggered by an enter key, this is the event; otherwise, this is null. Returns * Return true if you have consumed the action, else false.
Since: API Level 3Called when an action is being performed.
Parameters
v The view that was clicked.
actionId Identifier of the action. This will be either the identifier you supplied, or EditorInfo.IME_NULL if being called due to the enter key being pressed.
event If triggered by an enter key, this is the event; otherwise, this is null.
Returns * Return true if you have consumed the action, else false.