use addTextChangedListener
field1 = (TextInputLayout)findViewById(R.id.field1);
field2 = (TextInputEditText)findViewById(R.id.field2);
field2.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
// before text change
field1.setBackgroundColor() // set your color before active
}
public void onTextChanged(CharSequence s, int start,
int before, int count) {
// after add text in TextInputEditText
field1.setBackgroundColor() // set your color after active
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…