Android detect Done key press for OnScreen Keyboard

后端 未结 3 1996
渐次进展
渐次进展 2020-11-27 14:21

Is it possible to detect when the Done key of onScreen keyboard was pressed ?

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 15:07

    Using Butterknife you can do this

    @OnEditorAction(R.id.signInPasswordText)
    boolean onEditorAction(TextView v, int actionId, KeyEvent event){
        if (actionId == EditorInfo.IME_ACTION_DONE || event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
            /* Write your logic here that will be executed when user taps next button */
        }
        return false;
    }
    

提交回复
热议问题