-1

I need help making it so that when you open the keyboard, the "Done" button will close out the keyboard. P.S. I already have it so that the keyboard has the "Done" button. Thank you!

BradleyDotNET
  • 59,038
  • 10
  • 94
  • 113

2 Answers2

0

For iOS use resignFirstResponder

[textView resignFirstResponder]
[textField resignFirstResponder]
nikolaus
  • 804
  • 1
  • 9
  • 14
-1

You should add an listener on your edit:

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId== EditorInfo.IME_ACTION_DONE){
            // Dismiss the keyboard here.
            return true;
        }
        return false;
    }
});
zhang xuefeng
  • 357
  • 3
  • 11