知道编辑文本何时完成编辑

Knowing when Edit text is done being edited(知道编辑文本何时完成编辑)
本文介绍了知道编辑文本何时完成编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我如何知道我的编辑文本何时完成编辑?就像用户选择下一个框,或者按下软键盘上的完成按钮时一样.

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.

谢谢

推荐答案

通过使用类似这样的东西

By using something like this

 meditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            switch (actionId){
                case EditorInfo.IME_ACTION_DONE:
                case EditorInfo.IME_ACTION_NEXT:
                case EditorInfo.IME_ACTION_PREVIOUS:
                    yourcalc();
                    return true;
            }
            return false;
        }
    });

这篇关于知道编辑文本何时完成编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)
How can i use MYSQL database connection in iphone application useing cocos2d?(如何在使用 cocos2d 的 iphone 应用程序中使用 MYSQL 数据库连接?)
Smoothly drag a Sprite in cocos2d - iPhone(在 cocos2d 中平滑拖动一个 Sprite - iPhone)
Cocos2D complex animations(Cocos2D 复杂动画)