1、针对要进行编辑的文本框:设置
popEt.setImeOptions(EditorInfo.IME_ACTION_SEARCH); 2、针对这个软键盘设置点击监听popEt.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { //添加搜索事件 ToastUtil.showShort(this,"搜索"); } });
简单两步完成