2
如何在打字過程中讓textwatcher從250減少到0? android:maxLength="250"
設置,這樣就不會低於0.1Android textwatcher倒數
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);
TVC的長度.setText(String.valueOf(250 - s.length()));在ontTextChanged就足夠了。感謝您的想法! – erdomester 2012-03-23 16:18:23