Yi Wang
Yi Wang

Reputation: 91

How to disable EditText auto suggestion in android

So the case is, in the login screen of our app, one of user's phone always have his phone number popup as suggestion when he tips on the Phone Number box. like this image: enter image description here

Only his device (Google Pixel 2) have this popup box. All of others android testing or daily using devices do not have this popup. I have tried couple ways to dismiss the popup, but non of them are working.

XML:

<EditText
        android:id="@+id/phone_number"
        android:background="@null"
        android:layout_marginLeft="15dp"
        android:layout_width="match_parent"
        android:hint="@string/phone_num"
android:inputType="textVisiblePassword|textNoSuggestions|textFilter|phone"
        android:layout_height="50dp" />

java file: phone_number.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);

I have no idea what caused this popup and how to hide it. If you know the solution and reason behind it. Please help me. Many Thanks!

Upvotes: 5

Views: 3755

Answers (3)

Sujong Chae
Sujong Chae

Reputation: 13

android:importantForAutofill="no"
tools:targetApi="o"

You can add it to the EditText property.

Upvotes: 0

Zakhar Rodionov
Zakhar Rodionov

Reputation: 1493

Just write the answer Maxim, as he did not notice in the comments:

android:importantForAutofill="noExcludeDescendants"

Helps on phones with pure Android.

Upvotes: 6

Pulkit
Pulkit

Reputation: 1040

This is a feature of Google Pixel 2 not your app fault. Try this on Pixel 2 :- Settings > System > Languages, inputs & gestures > Advanced > Autofill services > Select None instead of Autofill with google.

Hope this helps

Upvotes: 0

Related Questions