什么是什么时候,EditText上更新了事件? [英] what is the event when and edittext is updated?
问题描述
我和两个edittexts一个是数量,一个是速度和总量一个TextView的android布局。
现在我想要做的是改变/更新,每当用户改变速度或数量字段的总量。
I have and android layout with two edittexts one for Qty and one for rate and a textview for total amount. now what i want to do is change/update the total amount whenever the user changes the rate or quantity fields.
什么是事件的EditText我期待并能我将它从布局XML属性像我可以设置的OnClick?
what is the edittext event i am looking for and can i set it from the layout xml properties like i can set OnClick?
推荐答案
有关这一点,你必须设置addTextChangedListener()来editText.Just如下
For this You have to set addTextChangedListener() to editText.Just as below
editText.addTextChangedListener(this);// your activity has to implement TextWatcher interface
比你要重写此方法
than you have to override this method
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
您可以使用任何这种方法作为乌拉圭回合的需要和改变乌尔有关意见文本
you can use any of this method as ur need and change ur relevant views text
这篇关于什么是什么时候,EditText上更新了事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!