如何使用的EditText onTextChanged事件时,我preSS多少? [英] How to use EditText onTextChanged event when i press the number?
问题描述
你好我有EditText上的文本= 0.00。当我preSS 3号应该像0.03安培;当我preSS 5号文应为0.35第二次。而35.0,35.09这样的。在最初的EditText具有与0.00的数值。
Hi am having EditText with the "text = 0.00". when i press the number 3 it should be like 0.03 & second time when i press the number 5 the text should be 0.35. And 35.0, 35.09 like this. The EditText initially having the value as 0.00.
这些都做同一样的EditText。
These are all done with the same EditText.
如何实现这一目标。我已经尝试了addTextChangedListener()与TextWatcher()。
How to achieve this.. I have tried on addTextChangedListener() with TextWatcher().
谁能建议我该怎么办呢?
Can Anyone suggest me how to do it...
由于在副词。
推荐答案
您已经选择了正确的做法。你必须在类TextWatcher延伸并覆盖 afterTextChanged()
, beforeTextChanged()
, onTextChanged()
。
You have selected correct approach. You have to extend the class with TextWatcher and override afterTextChanged()
,beforeTextChanged()
, onTextChanged()
.
您必须写在 afterTextChanged)所需的逻辑(
的方法来实现你所需要的功能。
You have to write your desired logic in afterTextChanged()
method to achieve functionality needed by you.
这篇关于如何使用的EditText onTextChanged事件时,我preSS多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!