-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
  • 60,462
  • 10
  • 96
  • 117

2 Answers2

0

For iOS use resignFirstResponder

[textView resignFirstResponder]
[textField resignFirstResponder]
ndraniko
  • 814
  • 1
  • 8
  • 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
  • 12