我需要帮助,以便在您打开键盘时,"完成"按钮将关闭键盘。附:我已经拥有它,以便键盘具有"完成"按钮。谢谢!
答案 0 :(得分:0)
对于iOS,请使用resignFirstResponder
[textView resignFirstResponder]
[textField resignFirstResponder]
答案 1 :(得分:-1)
您应该在编辑中添加一个监听器:
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;
}
});