Android OnEditorActionListener() actionId give 0 when I click Done key

前端 未结 2 1689
不思量自难忘°
不思量自难忘° 2021-02-06 00:51

I have created one keyboard.When user enter numbers , its entering particular EditText.But When User click on Done key, it didn\'t go to setOnEditorActionList

2条回答
  •  花落未央
    2021-02-06 01:53

    if you wanna got the actionid try this way:

    in my project i change the edittext's properties like that

    input type  -----  text
    ime options -----  actionDone
    

    and in java file:

      etSearch = (EditText) findViewById(R.id.etSearch);
      etSearch.setOnEditorActionListener(mEditorActionListener);
    
    private OnEditorActionListener mEditorActionListener = new OnEditorActionListener() {
    
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // TODO Auto-generated method stub
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                           //do something
            }
            return false;
        }
    };
    

    in this way could got the actionid = 6;

提交回复
热议问题