我需要在未聚焦时动态更改提示颜色属性。是否可以动态更改提示颜色(不在聚焦状态)。
实际设计
和我的 xml
未聚焦时,我无法以编程方式更改提示颜色属性。我被困住了。有可能吗?请帮我。这是我的代码 -
btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String email = emailEditText.getText().toString();
final String pass = passEditText.getText().toString();
if (email.isEmpty()) {
inputLayoutEmail.setHint("email is required to login");
inputLayoutEmail.setHintTextAppearance(R.style.EditTextLayout);
inputLayoutEmail.setError(" ");
emailEditText.setHintTextColor(getResources().getColor(R.color.primary_dark));
}
if (pass.isEmpty()) {
inputLayoutPassword.setHint("password is required to login");
passEditText.setHintTextColor(getResources().getColor(R.color.primary_dark));
inputLayoutPassword.setHintTextAppearance(R.style.EditTextLayout);
inputLayoutPassword.setError(" ");
inputLayoutPassword.clearFocus();
passEditText.setHint("Password is required to login");
passEditText.setHintTextColor(Color.RED);
}