当edittext的内容发生变化时,如何获取edittext值并将其存储在textview上?

时间:2011-08-08 12:39:32

标签: android android-edittext

如果更改edittext的内容,如何获取edittext值并将其存储在textview上?

2 个答案:

答案 0 :(得分:1)

NumofRevs_et.addTextChangedListener(new TextWatcher() {
  public void afterTextChanged(Editable s) {}

  public void beforeTextChanged(CharSequence s, int start, int count,int after) {
    //XXX do something
  }

  public void onTextChanged(CharSequence s, int start, int before, int count)
  {
    title_text.setText(s);  // set the Text View Value using the edit text value
  }
});

答案 1 :(得分:0)

EditText上的setTextWatcher .....然后根据需要覆盖onTextChanged,beforeTextChanged,afterTextChanged