Do not change TextInputLayout background on error

I manage to resolve this myself by overriding TextInputLayout like this : public class NoChangingBackgroundTextInputLayout extends TextInputLayout { public NoChangingBackgroundTextInputLayout(Context context) { super(context); } public NoChangingBackgroundTextInputLayout(Context context, AttributeSet attrs) { super(context, attrs); } public NoChangingBackgroundTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public void setError(@Nullable CharSequence error) { ColorFilter defaultColorFilter = … Read more

TextInputLayout Hint doesn’t float up after updating Google Support Library

You must provide hint to the TextInputLayout and use TextInputEditText instead of EditText <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”From”> <android.support.v7.widget.TextInputEditText android:layout_width=”match_parent” android:layout_height=”wrap_content” android:text=”09:00 AM” /> </android.support.design.widget.TextInputLayout>

TextInputLayout :How to give padding or margin to hint?

The solution proposed by ganesh2shiv works for the most part, although I’ve found it also de-centres the hint text displayed inside the EditText when not focused. A better trick is to set the desired paddingTop to the EditText but also embed the extra padding within the EditText’s background. A fairly sane way to do this … Read more

How to set TextInputLayout error message colour?

Create a custom style which uses @android:style/TextAppearance as parent in your styles.xml file: <style name=”error_appearance” parent=”@android:style/TextAppearance”> <item name=”android:textColor”>@color/red_500</item> <item name=”android:textSize”>12sp</item> </style> And use it in your TextInputLayout widget: <android.support.design.widget.TextInputLayout android:id=”@+id/emailInputLayout” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:errorTextAppearance=”@style/error_appearance”> Edit: Set the hint on the object, which is inside your TextInputLayout (EditText, TextView, etc.) to hold different colors for the hint … Read more

how to change color of TextinputLayout’s label and edittext underline android

Change bottom line color: <item name=”colorControlNormal”>#c5c5c5</item> <item name=”colorControlActivated”>@color/accent</item> <item name=”colorControlHighlight”>@color/accent</item> For more info check this thread. Change hint color when it is floating <style name=”MyHintStyle” parent=”@android:style/TextAppearance”> <item name=”android:textColor”>@color/main_color</item> </style> and use it like this: <android.support.design.widget.TextInputLayout … app:hintTextAppearance=”@style/MyHintStyle”> Change hint color when it is not a floating label: <android.support.design.widget.TextInputLayout … app:hintTextAppearance=”@style/MyHintStyle” android:textColorHint=”#c1c2c4″> Thanks to @AlbAtNf

Outlined Edit Text from Material Design

Read Outline Box . Outline text fields have a stroked border and are less emphasized. To use an outline text field, apply the following style to your TextInputLayout: style=”@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox” Dependencies implementation ‘com.android.support:design:28.0.0-alpha1’ XML <android.support.design.widget.TextInputLayout android:id=”@+id/name_text_input” style=”@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox” android:layout_width=”match_parent” android:layout_height=”wrap_content” > <android.support.design.widget.TextInputEditText android:id=”@+id/name_edit_text” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”@string/label_name” /> </android.support.design.widget.TextInputLayout> DEMO FYI Legacy support ended in Android 28 . … Read more

How to change the floating label color of TextInputLayout

Try The Below Code It Works In Normal State <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/TextLabel”> <android.support.v7.widget.AppCompatEditText android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”Hiiiii” android:id=”@+id/edit_id”/> </android.support.design.widget.TextInputLayout> In Styles Folder TextLabel Code <style name=”TextLabel” parent=”TextAppearance.AppCompat”> <!– Hint color and label color in FALSE state –> <item name=”android:textColorHint”>@color/Color Name</item> <item name=”android:textSize”>20sp</item> <!– Label color in TRUE state and bar color FALSE and TRUE State … Read more