Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在用户单击 android 键盘中的完成按钮时触发一个事件
例如:在登录活动中,当我输入密码并按键盘右下角的完成按钮时,它会关闭键盘,然后按登录按钮。而不是当用户按下键盘上的完成按钮时,应该进行身份验证。
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { // do your stuff here } return false; } });