Search code examples
androidxmlandroid-edittexthint

Difference between android:hint and android:autofillHints in EditText


I am unable to understand if there is any difference between

android:hint

and

android:autofillHints

in EditText

I have the following code -

android:hint="@string/enter_name"
android:autofillHints="@string/enter_name"

What is the difference here in the two lines?


Solution

  • android:hint is more like a placeholder that sort of explains what type of input the EditText is asking for. i.e. If an EditText is asking for posting a status on social media, the hint like What's on your mind? will be suitable. enter image description here

    android:autofillHints is to give actual values to the user to input in the EditText. Much like simulating a task for the user to think of a value to put inside the input field. The Autofill process requires more steps though as you also need to consider many things, like formatting the date. enter image description here