/**
*
* @param ets 受监听的文本框们
* @param confirmBtn 响应的button
*/
public static void testButton(final EditText[] ets, final Button confirmBtn) {
for (int i = 0; i < ets.length; i++) {
ets[i].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) {
}
@Override
public void afterTextChanged(Editable s) {
String trim = s.toString().trim();
if (trim.length() < 1) {
confirmBtn.setEnabled(false);
return;
} else {
for (int j = 0; j < ets.length; j++) {
String trim1 = ets[j].getText().toString().trim();
if (trim1.length() < 1) {
confirmBtn.setEnabled(false);
return;
} else {
confirmBtn.setEnabled(true);
}
}
}
}
});
}
}
*
* @param ets 受监听的文本框们
* @param confirmBtn 响应的button
*/
public static void testButton(final EditText[] ets, final Button confirmBtn) {
for (int i = 0; i < ets.length; i++) {
ets[i].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) {
}
@Override
public void afterTextChanged(Editable s) {
String trim = s.toString().trim();
if (trim.length() < 1) {
confirmBtn.setEnabled(false);
return;
} else {
for (int j = 0; j < ets.length; j++) {
String trim1 = ets[j].getText().toString().trim();
if (trim1.length() < 1) {
confirmBtn.setEnabled(false);
return;
} else {
confirmBtn.setEnabled(true);
}
}
}
}
});
}
}