TextWatcher textWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
...
}
...
};
textView.addTextChangedListener(textWatcher);
youredittext.addTextChangedListener(new TextWatcher()
{
@Override
public void afterTextChanged(Editable mEdit)
{
text = mEdit.toString();
textView.setText(text)
}
public void beforeTextChanged(CharSequence s, int start, int count, int after){}
public void onTextChanged(CharSequence s, int start, int before, int count){}
});
3条答案
按热度按时间nbysray51#
查看文本观察器-https://developer.android.com/reference/android/text/TextWatcher
7uzetpgm2#
使用文本观察器和转换像这样
4uqofj5v3#
使用文本监视器