如何将软键盘的返回键改为“搜索”

来源:互联网 发布:字体软件下载大全 编辑:程序博客网 时间:2024/06/06 03:36
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,"搜索");               }});

简单两步完成
0 0
原创粉丝点击