Done is not working in softKeyboard in Autocomplete TextView in android

前端 未结 4 1684
我寻月下人不归
我寻月下人不归 2020-12-18 22:04

I have One AutocompleTextView and I want to make the virtual keyboard disappear when he hits \"DONE\" at the AutocompleTextView. So far, the buttons \"NEXT\"/\"DONE\" do no

相关标签:
4条回答
  • 2020-12-18 22:27

    Check android:imeOptions attribute.

    0 讨论(0)
  • 2020-12-18 22:31

    Just add the following on yours XML layout file:

      android:imeOptions="actionDone"
      android:singleLine="true"
    
    0 讨论(0)
  • 2020-12-18 22:32

    Add this Property to your AutoCompleteTextView in xml:

    android:imeOptions="actionDone"
    
    0 讨论(0)
  • 2020-12-18 22:37

    The following works for all the Views which support imeOptions; for instance EditText, TextView, AutocompleteTextView, etc.

    In your xml:

    <autocompleteTextView
    
    inputType = "text"
    imeOptions = "actionDone"
    />
    

    In Java:

    autocomplete = (AutoCompleteTextView) issueDetailView.findViewById(R.id.yourId);
    autocomplete.setOnEditorActionListener(new TextView.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                   if(actionId== EditorInfo.IME_ACTION_DONE) {
                      //do Whatever you Want to do
                   }
                    return true;
                }
            });
    
    0 讨论(0)
提交回复
热议问题