I tried this solution like added attributes in main theme but unable to change color of bottom line in TextInputLayout, by default its taking up color of status bar (its probably called primarydark), also I dont want to change color of bottom line when error text appear below TextInputLayout meaning instead of changing red when error occurs it should be of that color when it gets focus
Asked
Active
Viewed 799 times
0
-
have you tried `android:backgroundTint="@color/red(your colour)"` ??? – Akshay N Shaju Oct 30 '17 at 12:53
-
Try [this](https://stackoverflow.com/questions/45408295/change-textinputlayout-focused-unfocused-hint-color-programmatically/45409379#45409379) – KeLiuyue Oct 30 '17 at 12:57
-
i think it will just change the color of bottom line but what about when its focus or when error occures – blackHawk Oct 30 '17 at 12:57
1 Answers
0
When there is any error occur and you want to reset your editText and your bottom line color, then just use below code
textInputLayout.setError(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textEditText.getBackground().setColorFilter(getResources().getColor(R.color.your_color,getTheme()), PorterDuff.Mode.SRC_ATOP);
}else {
//noinspection deprecation
textEditText.getBackground().setColorFilter(getResources().getColor(R.color.your_color), PorterDuff.Mode.SRC_ATOP);
}

shahid17june
- 1,441
- 1
- 10
- 15