Changing Android's (5.0>) EditText error background color -
i searched everywhere without success. looking @ source code, 'magic' done in class android.widget.editor (marked @hide) when in method showerror():
final textview err = (textview) inflater.inflate(com.android.internal.r.layout.textview_hint, null); and in textview_hint.xml:
<textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:textappearance="?android:attr/textappearancesmall" android:textcolor="?android:attr/textcolorprimaryinverse"/> the thing cant extend editor (because it's marked @hide) , didn't figure out way override setting
how changing background color , textcolor styles error messsage achieved?
it's easy if use new textinputlayout new design support library. need wrap edittext in textinputlayout , set text appearance error message (and hint) there.
<android.support.design.widget.textinputlayout android:layout_width="wrap_content" android:layout_height="wrap_content" app:errortextappearance="@style/customerrorstyle" app:hinttextappearance="@style/customhintstyle"> <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolorhint="@color/full_size_hint_color" android:hint="hint" /> </android.support.design.widget.textinputlayout>
Comments
Post a Comment