I am using android design library's TextinputLayout. But couldn't customize the underline color of EditText inside TextinputLayout. Please help.
   <android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_pincode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/input_layout_city"
        android:layout_marginTop="@dimen/_10sdp"
        android:textColorHint="#000000"
        app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
        <EditText
            android:id="@+id/input_pincode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Pincode*"
            android:textSize="@dimen/_13sdp" />
    </android.support.design.widget.TextInputLayout>
<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">
    <item name="android:textColor">@color/black</item>
    <item name="android:textSize">@dimen/_13sdp</item>
    <item name="colorControlNormal">@color/black</item>
</style>
                Add this style to your styles.xml file :
<style name="TextLabel" parent="TextAppearance.AppCompat">
        <!-- Hint color and label color in FALSE state -->
        <item name="android:textColorHint">#fff</item>
        <item name="android:textSize">20sp</item>
        <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
        <item name="colorAccent">@color/colorPrimaryDark</item>
        <item name="colorControlNormal">#e34b1c</item>
        <item name="colorControlActivated">#e34b1c</item>
</style>
Then add the 'TextLabel' theme to your textinputlayout as below
<android.support.design.widget.TextInputLayout
        android:id="@+id/input_layout_pincode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/input_layout_city"
        android:layout_marginTop="@dimen/_10sdp"
        android:textColorHint="#000000"
        app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
        android:theme="@style/TextLabel">
...
Play around with the colors you want in the styles.xml.
In your TextAppearence.App.TextInputLayout style, you need to add colorControlActivated and colorControlHighlight.
<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">
    <item name="android:textColor">@color/black</item>
    <item name="android:textSize">@dimen/_13sdp</item>
    <item name="colorControlNormal">@color/black</item>
    //added attributes
    <item name="colorControlActivated">@color/colorPrimary</item> 
    <item name="colorControlHighlight">@color/colorPrimary</item>
</style>
Edited:
You can remove colorControlHighlight. In your case, it is not necessary. colorControlHightlight is used to applied color on ripple, list selected etc.
You can refer to @Gaëtan Maisse answer here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With