如何获得 EditText 更改?

How can I get EditText change?(如何获得 EditText 更改?)
本文介绍了如何获得 EditText 更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个 EditText,我想在每次文本更改时通知(输入每个字符).我应该使用什么实现,应该覆盖什么功能?

I have a EditText and I want to inform each time text changes (with entering each character). What implementation should I use and what function should I override?

推荐答案

在你的 EditText 上使用 addTextChangedListener 方法并让你的类实现或定义一个实现 TextWatcher 类:

Use the addTextChangedListener method on your EditText and make your class implement or define an inner class implementing the TextWatcher class:

https://developer.android.com/reference/android/widget/TextView.html#addTextChangedListener(android.text.TextWatcher)

这篇关于如何获得 EditText 更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

相关文档推荐

Getting the world#39;s contactListener in Box2D(在 Box2D 中获取世界的contactListener)
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
cocos2d-android: how to display score(cocos2d-android:如何显示分数)
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
Android file copy(安卓文件拷贝)