How to make TextInputLayout hint asterisk red for required fields

You can use the Material Components Library.
Starting from the 1.2.0-alpha05 you can format the hint text.

For example you can just use something like:

<com.google.android.material.textfield.TextInputLayout
    android:hint="@string/hint_test"
    ...>

with:

<string name="hint_test">Legal name <font color="#FF0000">*</font></string>

enter image description hereenter image description here

Leave a Comment