suchen

Heim  >  Fragen und Antworten  >  Hauptteil

android - 有没有人做过类似支付宝那种汇率换算功能的?

有没有人做过类似支付宝那种汇率换算功能的?被两个互相监听的edittext搞死,求demo

PHPzPHPz2772 Tage vor693

Antworte allen(1)Ich werde antworten

  • 阿神

    阿神2017-04-17 17:30:28

    edit_en.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) {
                    if (edit_en.isFocused()) {
                        edit_zh.setHint("0");
                        edit_en.setHint("请输入金额");
                        edit_zh.setText(dollar2RMB(s.toString())+"");
                        Log.d("aa", "edit_en::" + s.toString());
                    }
                }
    
                @Override
                public void afterTextChanged(Editable s) {
    
                }
            });
    
            edit_zh.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) {
                    if (edit_zh.isFocused()) {
                        edit_zh.setHint("请输入金额");
                        edit_en.setHint("0");
                        edit_en.setText(rmb2Dollar(s.toString()) + "");
                        Log.d("aa", "edit_zh::" + s.toString());
                    }
                }
    
                @Override
                public void afterTextChanged(Editable s) {
    
                }
            });

    Antwort
    0
  • StornierenAntwort