You can show error as PopUp of EditText
if (editText.getText().toString().trim().equalsIgnoreCase("")) {
editText.setError("This field can not be blank");
}
and that will be look a like as follows
firstName.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
if (firstName.getText().toString().length <= 0) {
firstName.setError("Enter FirstName");
} else {
firstName.setError(null);
}
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…