Android EditText实时监听

jiFenEd.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) {
  String min = jiFenEd.getText().toString();
        int i=Integer.valueOf(min).intValue();
        if (i<0){
            jiFenEd.setText("0");
            i=0;
        }else{
           if(i>allJiFen){
               jiFenEd.setText(allJiFen+"");
           }
        }
        jiFenJinE=i;
        double d=(double)dingDanJiaGe-(double)hongBaoJiaGe-(double)jiFenJinE/100;
        priceAll.setText("¥"+d);
    }
});
}});
阅读更多
换一批

没有更多推荐了,返回首页