Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Edit Text Underline Color to be the same when off focused & focused

Tags:

android

xml

enter image description hereMy Edit Text underline seems to always be highlighted when focused, I've been trying to have all lines the same color as the first one in the picture, here is my XML code, would anyone know how to have all three lines highlighted (even when other edit text's are not focused)? Thanks in advance!!!

<EditText
        android:id="@+id/edit_password_second"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:textColor="@color/edit_text_color"
        android:backgroundTint="@color/edit_text_color"
like image 434
DanielRM Avatar asked May 19 '17 18:05

DanielRM


2 Answers

You can try adding a theme

<style name="EditTextTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">@color/primary</item>
<item name="colorControlActivated">@color/primary</item>
<item name="colorControlHighlight">@color/primary</item>
</style>

and set it on your EditText

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/EditTextTheme">
</EditText>
like image 51
Stamatis Stiliats Avatar answered Sep 20 '22 00:09

Stamatis Stiliats


Go to styles.xml and change <item name="colorAccent">#YOUR_COLOR</item> to the same color as your EditText's backgroundTint

like image 30
grantespo Avatar answered Sep 21 '22 00:09

grantespo