Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Line Color of EditText - Android

Can I change the line color on EditText. When is active it has some greenish color.Image

Is it possible to change only the color of line when is active, and how can I do this...?

like image 413
KiKo Avatar asked Nov 26 '14 14:11

KiKo


4 Answers

I had the same problem solved it by changing the color of the backgroundTint as follows -

android:backgroundTint="@color/light_color"

like image 82
Kaveri Avatar answered Oct 21 '22 09:10

Kaveri


You need to set background source for an edit text.

  1. Generate it http://android-holo-colors.com/
  2. Than you can apply generated drawable as background like android:background="@drawable/my_theme_edit_text" for the custom EditText. Or you can set that background in your app theme - you will find example in .zip file from that site
like image 10
Serhii Nadolynskyi Avatar answered Nov 07 '22 20:11

Serhii Nadolynskyi


add to your themes.xml this line:

<item name="colorAccent">@color/black</item>

this sets the default color for colorControlActivated which is used to tint widgets

like image 9
dieter Avatar answered Nov 07 '22 20:11

dieter


Here you are:

editText.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
like image 9
toni Avatar answered Nov 07 '22 18:11

toni