机器人:当完成关键Softkeyboard执行操作是pressed [英] android: Softkeyboard perform action when Done key is pressed

查看:155
本文介绍了机器人:当完成关键Softkeyboard执行操作是pressed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个EditText。我想要输入一些文字后,当用户presses softkeybard的完成关键的,它应该执行哪个我也实现了按钮单击事件的一些搜索操作。如何做到这一点... ???

I have an EditText. I want that after typing some text, when user presses the Done key of softkeybard, it should perform some search operation which I have also implemented in a button click event. How to do that...???

推荐答案

试试这个

editText.setOnEditorActionListener(new OnEditorActionListener() {        
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if(actionId==EditorInfo.IME_ACTION_DONE){
            //do something
        }
    return false;
    }
});

这篇关于机器人:当完成关键Softkeyboard执行操作是pressed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆