当编辑文本完成正在编辑了解 [英] Knowing when Edit text is done being edited

查看:79
本文介绍了当编辑文本完成正在编辑了解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何知道我的编辑文本完成正在编辑?当用户选择下一个框,或presses软键盘上的完成按钮,就像

How do I know when my edit text is done being edited? Like when the user selects the next box, or presses the done button on the soft keyboard.

我想知道这个,所以我可以钳制输入。它看起来像文本观察者的afterTextChanged发生,如果输入的字符之后。我需要做一些计算和输入,所以我想避免这样做的计算,如果输入的字符之后。

I want to know this so I can clamp the input. It looks like text watcher's afterTextChanged happens after each character is entered. I need to do some calculations with the input, so I would like to avoid doing the calculation after each character is entered.

感谢

推荐答案

通过使用这样的事情

 meditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {

                yourcalc();

                return true;
            }
            return false;
        }
    });

这篇关于当编辑文本完成正在编辑了解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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