0

I'm trying to change the color of the floated label "Email" as seen in the screenshot.

Login Screen with wrong floated label color

Here is the contents of the layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.premedios.streetler.LoginActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="150dp"
    android:orientation="vertical"
    android:layout_marginTop="10dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:src="@drawable/logo"/>

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:orientation="vertical">
    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/TextLabel">
        <EditText
            android:id="@+id/email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/email_hint"/>
    </android.support.design.widget.TextInputLayout>
    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/TextLabel">
        <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/password_hint"/>
    </android.support.design.widget.TextInputLayout>
    <Button
        android:id="@+id/login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:background="@color/colorText"
        android:text="@string/LoginButtonText"
        android:textColor="@color/colorPrimaryDark"
        android:textSize="20sp"/>
    <com.facebook.login.widget.LoginButton
        android:id="@+id/facebook_login_button"
        android:layout_gravity="center_horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:height="44dp"
        android:visibility="gone"/>
    <TextView
        android:id="@+id/signup"
        android:layout_width="match_parent"
        android:layout_height="44dp"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:text="@string/register_link_text"
        android:textSize="18sp"/>
</LinearLayout>

I would like to change that floated label color the same as the hint color. Any help appreciated.

pedroremedios
  • 763
  • 1
  • 11
  • 39
  • I recommend to you, to make a look at http://www.hermosaprogramacion.com/2016/03/edittext-android/, hope it be helpful ;) – M. Mariscal Apr 25 '16 at 21:30

1 Answers1

0

Use this link

<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 -->
<item name="colorAccent">@color/Color Name</item>
<item name="colorControlNormal">@color/Color Name</item>
<item name="colorControlActivated">@color/Color Name</item>

you only need to use this style in your textInputLayout

Community
  • 1
  • 1
Darpan
  • 5,623
  • 3
  • 48
  • 80