0

I am implement floating label as per material design . Now i want to change the color of few elements like change the color of default hint (Email id which black right now) and line below it . enter image description here

I have gone through similar question like these but couldn't solve my problem .

<resources>
<style name="AppTheme" parent="AppTheme.BaseTheme"></style>

<style name="AppTheme.BaseTheme" parent="Theme.AppCompat.Light.NoActionBar">

</style>
<style name="Signin_EditText" parent="TextAppearance.AppCompat">
    <item name="colorAccent">@color/white</item>
    <item name="colorPrimary">@color/white</item>

    <item name="android:editTextColor">@color/white</item>
    <item name="colorControlActivated">@color/white</item>
    <item name="colorControlHighlight">@color/white</item>
</style>

            <android.support.design.widget.TextInputLayout
                android:id="@+id/text_input_layout_email"
                android:layout_width="match_parent"
                app:hintTextAppearance="@style/Signin_EditText"
                android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/edittext_emailid"
                    android:layout_width="match_parent"
                    android:textSize="14sp"
                    android:minHeight="35dp"
                    android:layout_height="wrap_content"
                    android:textColorHint="@color/white"
                    android:inputType="textEmailAddress"
                    android:textColor="@color/white"
                    android:hint="@string/emailid"/>
            </android.support.design.widget.TextInputLayout>
Code_Life
  • 5,742
  • 4
  • 29
  • 49
  • `colorControlActivated` etc. are *theme* attributes. They will *NOT* be resolved if you apply them via `android:textAppearance` or `style` attribute. Theme attributes must be applied via `android:theme` attribute. – Eugen Pechanec Sep 15 '15 at 13:46

3 Answers3

0

Try this.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorControlNormal">@color/primary_light</item>
    <item name="colorControlHighlight">@color/primary_light</item>
    <item name="colorControlActivated">@color/primary_light</item>
    <item name="colorAccent">@color/primary_light</item>
    <item name="colorPrimary">@color/primary_light</item>
    <item name="colorPrimaryDark">@color/secondary_dark</item>
</style>
Mehul Kabaria
  • 6,404
  • 4
  • 25
  • 50
  • this wouldn't help me as this would set the style throughout the application , i want to set it for one particular edittext . – Code_Life Sep 15 '15 at 11:47
0

Change your colorAccent to the required color.

eyal
  • 2,379
  • 7
  • 40
  • 54
-1

You can't Override the Colors colorAccent, colorPrimary, colorPrimaryDark or any other colors which are used for Theme by AppCompact. You can only Define them in Application Theme which you will in use in Manifest file.

If you want Customize your theme colors, you have to define them in BaseTheme which you are using in Manifest file <application... tag as below

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorControlNormal">@color/primary_light</item>
    <item name="colorControlHighlight">@color/primary_light</item>
    <item name="colorControlActivated">@color/primary_light</item>
    <item name="colorAccent">@color/primary_light</item>
    <item name="colorPrimary">@color/primary_light</item>
    <item name="colorPrimaryDark">@color/secondary_dark</item>
</style>

Manifest file:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
...
</application>
user3616287
  • 145
  • 1
  • 1
  • 11