I am trying to change the holo underline color of a single EditText programmatically. I have tried all the examples I could find on SO, but nothing seems to work. Here is my latest and best attempt:
EDIT: Current code:
txtName.Background.ClearColorFilter();
txtName.Background.SetColorFilter(Android.Graphics.Color.ParseColor("#ff0000"), PorterDuff.Mode.SrcIn);
I have also tried just using txtName.Background.SetTint(Resource.Color.colorRed)
but that did not work either.
Here is a picture of the line color I am trying to change:
EditText XML:
<EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
android:maxLength="30"
android:singleLine="true"
android:scrollHorizontally="true"
android:hint="Name"
android:textColor="#8c8c8c"
android:textColorHint="#8c8c8c"
app:backgroundTint="#22d6d3"
android:layout_marginBottom="10dp" />
EDIT - Here is the code that ended up working:
ViewCompat.SetBackgroundTintList(txtName, Android.Content.Res.ColorStateList.ValueOf(Color.Red));