我已将我的应用配置为使用 compileSdkVersion 26
支持Android Oreo。 我还为我的电话号码输入字段设置了 android:autofillHints =“phone”
。 当我点击该字段时,我可以看到“自动填充”弹出。 但是,当我点击“自动填充”时,会出现“无法自动填充内容”的提示,并且我在logcat中看到以下跟踪:
RemoteFillService Not handling { when=-3ms what=3 target=com.android.internal.os.HandlerCaller$MyHandler } as service for ComponentInfo{com.google.android.gms/com.google.android.gms.autofill.service.AutofillService} is already destroyed
View dispatchProvideAutofillStructure(): not laid out, ignoring
我该如何修复这个问题?我已确认在设置 > 系统 > 语言和输入 > 高级 > 输入辅助 > 自动填充服务中已配置电话号码。
附带一个XML示例的更新:在API 26模拟器设置中,我可以选择“使用Google自动填充”。在Android Studio的Design选项卡中,我添加了一个“手机”类型的EditText
,然后手动在XML元素中插入了 android:autofillHints="phone"
。
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone"
android:autofillHints="phone" />
可以使用此 XML 观察上面描述的 Logcat 特性。
android:autofillHints="phone"
之外,XML或代码中没有什么特别的。我会尽力找时间详细说明。然而,在当前状态下,使用Google自动填充似乎是一个不太成熟的功能:https://plus.google.com/+JuusoOhtonen/posts/4kzMk5LUGLW - Juuso Ohtonen