1

XML

     <com.google.android.material.textfield.TextInputLayout
                    style="@style/TextInputLayout"
                    android:id="@+id/abc_TIL"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
    
                    >
    
                    <EditText
                        android:id="@+id/abc_TV"
                        style="@style/EditText"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:digits="0123456789"
                        android:hint="abc*"
                        android:maxLength="11"
                        android:inputType="number"
                        android:maxLines="1"
                        android:textSize="@dimen/_12sdp" />
    
                </com.google.android.material.textfield.TextInputLayout>

style


     <style name="EditText" parent="Widget.TextView">
            <item name="android:textSize">@dimen/_13sdp</item>
            <item name="android:textColor">@color/Black</item>
            <item name="hintTextColor">@color/dark_grey</item>
            <item name="colorControlNormal">@color/dark_grey</item>
            <item name="colorControlActivated">@color/dark_grey</item>
            <item name="colorControlHighlight">@color/dark_grey</item>
            <item name="android:background">@drawable/background_grey</item>
        </style>
    
        <style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
            <item name="android:layout_marginLeft">@dimen/_10sdp</item>
            <item name="android:layout_marginRight">@dimen/_10sdp</item>
            <item name="android:layout_marginTop">@dimen/_6sdp</item>
            <item name="hintTextColor">@color/dark_grey</item>
            <item name="android:textColorHint">@color/dark_grey</item>
            <item name="colorControlNormal">@color/dark_grey</item>
            <item name="colorControlActivated">@color/dark_grey</item>
            <item name="colorControlHighlight">@color/dark_grey</item>
            <item name="errorIconDrawable">@null</item>

**Also tried app:hintTextApperance , app:errorTextApperance but not getting what i am expecting . i want hint color & error color to be different during error .Hint color should not be red when error occurs , it should be gray & error text should be red **

Himanshu HC
  • 47
  • 1
  • 5

1 Answers1

0

Edit: Set the hint on the object, which is inside your TextInputLayout (EditText, TextView, etc.) to hold different colors for the hint and the error.

Visit link.

John Moses
  • 11
  • 2