EditText underline below text property

android, android-edittext, authentication

Solution

It's actually fairly easy to set the underline color of an EditText programmatically (just one line of code).

To set the color:

editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);

To remove the color:

editText.getBackground().clearColorFilter();

Note: when the EditText has focus on, the color you set won't take effect, instead, it has a focus color.

API Reference:

Drawable#setColorFilter

Drawable#clearColorFilter

Problem

I would like to change the blue colour below the edit text, i don't know what property it is. I tried using a different background colour for it but it didn't work. I've attached an image below:

Original source

Related problems