はじめに
自前のWebViewを実装するときにHTMLのフォーム入力でAutofill表示しないようにしたかったときのメモ。
検証環境
- Pixel3
- Android 9
解決策
WebViewの importantForAutofill
に IMPORTANT_FOR_AUTOFILL_NO
を指定する(Android O / API 26以上の場合のみ)。
webView.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO
}
}