2

I have an app to track parcels, so you can create a parcel by specifying name and track code. I guess that due to Android detecting the field is called "name", whenever the input gets focus I get a suggestion of names from the accounts google has stored on the phone.

How can I prevent this? These suggestions are useless in my case.

i tried specifying textNoSuggestions on my editText but it does not fix it.

MichelReap
  • 5,630
  • 11
  • 37
  • 99

2 Answers2

3

You can use the property android:importantForAutofill like this:

<RelativeLayout 
    android:importantForAutofill="noExcludeDescendants">

    
    <EditText
        android:id="@+id/txtNameFirst"
        android:hint="fist name"
        android:inputType="textPersonName|textCapWords"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>


    <EditText
        android:id="@+id/txtNameLast"
        android:hint ="last name"
        android:inputType="textPersonName|textCapWords"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/txtNameFirst"/>

</RelativeLayout>
Simon
  • 1,890
  • 19
  • 26
0

I think this has been answered before on SO. Please see this answer and try the workaround suggested.

It suggests that you should create your own custom EditText class by extending to AppCompatEditText and then you should override the getAutofillType method.

Csaba Farkas
  • 794
  • 7
  • 11