Is there a way to set or change the tint of the EditText error icon? it is red with an exclamation mark. I want to set or change the tint to a color of my choosing.
I don't think there is an easy way to change the tint color without replacing the icon. Fortunately, the material icon set in Android Studio -> Vector Asset -> Clip Art
provide an error icon which looks similar.
val icon = AppCompatResources.getDrawable(context, R.drawable.ic_error_black_24dp)
// change icon color
DrawableCompat.setTint(icon, Color.parseColor("#F6CECE"))
// this is necessary, else icon won't show
icon.setBounds(0, 0, icon.intrinsicWidth, icon.intrinsicHeight)
// setError
editText.setError(getString(R.string.validation_required), icon)
https://code.luasoftware.com/tutorials/android/android-edittext-custom-seterror-icon/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With