member_consumption_xiaofeijine 是安卓的Edittext输入框
private void initView() {
//修改消费金额的时候,计算折扣后的金额
member_consumption_xiaofeijine.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after){
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
//值改变后做的处理
Float jine=Float.parseFloat(s.toString());
Float zhehoujine=jine*zhekou/100;
member_consumption_amount.setText(zhehoujine.toString());
}
});
}