如何在打字过程中让 textwatcher 从 250 倒计时到 0?android:maxLength="250"
已设置,因此它不会低于 0。
et_Notes = (EditText) dialog_list.findViewById(R.id.EditText_Notes);
tvC = (TextView)dialog_list.findViewById(R.id.TextViewCounter);
final TextWatcher mTextEditorWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
tvC.setText(String.valueOf(s.length()));
}
public void afterTextChanged(Editable s) {
}
};
et_Notes.addTextChangedListener(mTextEditorWatcher);