【发布时间】:2020-11-24 05:18:19
【问题描述】:
我有一个简单的创建帐户屏幕,如图所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAutofill="yes"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:hint="email"
android:inputType="textEmailAddress">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="Create a password"
android:inputType="textPassword">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="Re-enter password"
android:inputType="textPassword">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
当我选择电子邮件字段时,谷歌自动填充服务会建议填写一个电子邮件地址。有没有办法触发密码管理器建议一个新的安全密码?我在谷歌浏览器中看到了这种行为,这个功能在原生安卓应用中可用吗?
【问题讨论】:
标签: android passwords autofill