Haitham Haitham
Haitham Haitham

Reputation: 157

Make label color on TextInputLayout difference than editText hint text color

Can I make label text color on TextInputLayout different than the editText hint text color

<android.support.design.widget.TextInputLayout xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/layoutMargin16"
                android:textColorHint="@color/green"
                app:hintTextAppearance="@style/textLayoutInputSize">

                <EditText
                    android:id="@+id/editTextFirstName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/layoutMargin16"
                    android:textColorHint="@color/blueColorButton"
                    android:hint="@string/first_name" />
            </android.support.design.widget.TextInputLayout>

I have this code however android:textColorHint="@color/blueColorButton" how to set text color for it (different color than the TextInputLayoutlabel) Image 1

Image 2

Upvotes: 0

Views: 169

Answers (1)

Amit Viradiya
Amit Viradiya

Reputation: 177

You need to set theme in TextInputLayout. I attach one example. I hope it 's works for you.

<android.support.design.widget.TextInputLayout
   android:theme="@style/EditTextTheme">

</android.support.design.widget.TextInputLayout>

<style name="EditTextTheme" parent="TextAppearance.AppCompat">
   <item name="android:textColorHint">@color/colorWhiteAlpha</item>
   <item name="android:textSize">@dimen/font_16sp</item>
   <item name="colorAccent">@color/colorWhite</item>
   <item name="colorControlNormal">@color/colorWhiteAlpha</item>
    <item name="colorControlActivated">@color/colorWhiteAlpha</item>
    <item name="android:textColorHighlight">@color/colorWhiteAlpha</item>
    <item name="android:textColorLink">@color/colorWhiteAlpha</item>
</style>

Upvotes: 3

Related Questions