So I don't think it is possible to disable the hint for the error (I could possibly be very wrong). The best way to handle this is to just change the color of the line in the editText by using setSupportBackgroundTintList or setBackgroundTintList.
A few key things.
1) If you are on sdkVersion 23 or higher then you can use the regular editText and the setBackgroundTintList method.
2) If you are between then 23-19, I think you can use it on lower sdkVersions as well. You have to use the Appcompat EditText in your layout.
3) Using setSupportBackgroundTintList will show as an error, but that is because there is a bug with the support library.You can just suppress the lint error in the method/place you are using it.
Here are some code snippets. I hope this helps anyone who is just looking to change the color of the line in an editText.
AppCompatEditText in my layout.
<android.support.design.widget.TextInputLayout
android:id="@+id/login_user_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:hint="@string/login_hint_password"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_user_email_layout"
app:layout_constraintBottom_toTopOf="@id/error_text"
app:layout_constraintRight_toRightOf="parent">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/login_user_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"/>
</android.support.design.widget.TextInputLayout>
Method I set the underline color in.
@SuppressLint("RestrictedApi")
private void setEditTextFields(){
if(errorLoginIn){
errorLoginIn = false;
binding.errorText.setVisibility(View.VISIBLE);
binding.loginUserEmail.setSupportBackgroundTintList(getResources().getColorStateList(R.color.colorError));
binding.loginUserPassword.setSupportBackgroundTintList(getResources().getColorStateList(R.color.colorError));
}else{
binding.errorText.setVisibility(View.INVISIBLE);
binding.loginUserEmail.setSupportBackgroundTintList(getResources().getColorStateList(R.color.primaryColor));
binding.loginUserPassword.setSupportBackgroundTintList(getResources().getColorStateList(R.color.primaryColor));
}
}
binding is the layout since I'm using data binding.
Hope this helps someone.