Reputation: 696
I have a TextInputLayout and Edittext inside that, Need to make the hint with multiple styles like Date of Birth mm/dd/yyyy. The mm/dd/yyyy only should be italic and when we focus on the Edittext the same format text should be there on the top (as TextInputLayout working).
What I have tried, and the similar ones are out there:
For both the above Issue -- when the focus is on the edittext the floating text not available.
Need to know how we can style TextInputLayout hint with multiple styles having the floating also with the same styled text.
Upvotes: 1
Views: 356
Reputation: 363469
With the Material Components library, starting with 1.2.0-alpha05
you can format the hint text.
Just use:
<com.google.android.material.textfield.TextInputLayout
android:hint="@string/hint_italic"
>
with:
<string name="hint_italic">Date of Birth <i>mm/dd/yyyy</i></string>
Upvotes: 0