Change EditText Hint Color When Using TextInputLayout


Answer :

Define android:textColorHint in your application theme:

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">     <item name="colorPrimary">@color/primary</item>     <item name="colorPrimaryDark">@color/primary_dark</item>     <item name="colorAccent">@color/accent</item>      <item name="android:textColorHint">@color/secondary_text</item> </style> 

Source


Create custom style in style.xml

<style name="EditTextHint" parent="TextAppearance.AppCompat">     <item name="colorAccent">@android:color/white</item>     <item name="android:textColorHint">@color/BackgroundtWhiteColor</item>     <item name="colorControlNormal">@color/BackgroundtWhiteColor</item>     <item name="colorControlActivated">@color/your color</item>     <item name="colorControlHighlight">@color/BackgroundtWhiteColor</item> </style> 

Then in your layout xml file, add theme attribute as below

 <android.support.design.widget.TextInputLayout             android:theme="@style/EditTextHint"             android:layout_width="match_parent"             android:layout_height="wrap_content">        <EditText             android:layout_width="match_parent"             android:layout_height="wrap_content"/>  </android.support.design.widget.TextInputLayout> 

hope this works


Add textColorHint property to your edit text

android:textColorHint="#F6F6F6" 

or whichever color you want


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?