Android Oreo disable autofill for EditText

12.2k Views Asked by At

I'm trying to disable autofill for all EditText's except my login screen. And no success yet. There is always "Autofill" option after longPress on editText. IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS for rootView or IMPORTANT_FOR_AUTOFILL_NO for view gives no effect at all.

Any ideas? Thanks.

2

There are 2 best solutions below

0
On

maybe you have the same problem as I had I mixed-up suggestion and auto-fill, then I set importantForAutofill to false and everything was fine

1
On

you can pass "no" to importantForAutofill e.g.

<EditText
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:importantForAutofill="no" />