How to keep the color of text in TextInputLayout same when it is in focused and unfocused state?

Viewed 849

I wanted to keep the color of text in TEXT INPUT LAYOUT same when it is in focused or unfocused state. When I click on EDIT TEXT(focused state) I see different color and when it is unfocused I see different color. Code is attached below.

text_with_edit_text.xml

<LinearLayout
        android:id="@+id/linearLayoutlocality_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.design.widget.TextInputLayout
            android:id="@+id/tv_locality_2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:hintTextAppearance="@style/custom_text_appearance">
            <EditText
                android:id="@+id/et_locality_2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="locality_2"
                />
        </android.support.design.widget.TextInputLayout>
    </LinearLayout>

styles.xml

<style name="custom_text_appearance" parent="@android:style/TextAppearance">
        <item name="android:textSize">12sp</item>
        <item name="android:typeface">normal</item>
        <item name="android:textColor">#FF5733</item>
    </style>

**

  • For Instance

** - I am attaching the image below, I want the color of 'Nombre'(text focused at this movement) to remain same when it is not focused. Also note that the color of hint in EditText should not be same as that of 'Nombre'(when it is in unfocused state)

2 Answers
Related