Change TextInputLayout only hint text style

Misha Akopov picture Misha Akopov · Oct 24, 2016 · Viewed 10.8k times · Source

I am trying to change TextInputLayout hint text style to bold. I changed color and other styles of hint in styles with use of TextAppearance :

 <style name="MyTextInputLayoutTheme" parent="@android:style/TextAppearance">
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:textColorHint">@color/black_50</item>
        <item name="colorControlNormal">@color/green</item>
        <item name="hintAnimationEnabled">false</item>        
    </style>

I tried to set

<item name="android:textStyle">normal</item>

or

<item name="android:textStyle">bold</item>

but it doesn't work. Hint text always has style of edit text (if edittext is bold, it automatically has bold hint, if not, the hint is normal) :

enter image description here

Answer

Schadenfreude picture Schadenfreude · Sep 29, 2017

The easiest thing that comes to mind is this:

Inside strings.xml <string name="myHint"><b>Your hint here</b></string>
In your layout.xml file <EditText android:hint="@string/myHint"/>