我见过很多应用程序,当我单击电子邮件的 EditText 时,它会显示我在设备上使用的电子邮件列表,例如图像
我确信它不是 AccountManager,因为它没有请求我的许可,也不是 Google 智能锁
另外,我尝试了自动填充
服务
<android.support.design.widget.TextInputLayout
android:id="@+id/editNameInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<android.support.design.widget.TextInputEditText
android:id="@+id/editName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/name"
android:imeOptions="actionNext"
android:inputType="text"
android:textAlignment="viewStart"/>
</android.support.design.widget.TextInputLayout>
并以编程方式但它不起作用
editEmail.setAutofillHints(View.AUTOFILL_HINT_EMAIL_ADDRESS);
editEmail.setImportantForAutofill(IMPORTANT_FOR_AUTOFILL_YES);
最佳答案
Autofill framework提供填写先前输入的密码、信用卡号等功能。
您可以设置autofillhints
以允许此框架填写详细信息。
关注Optimize your app for autofill了解更多详情
注意:
An autofill service must be configured on your device for your app to use the autofill framework. Although most phones and tablets running Android 8.0 (API level 26) and higher ship with an autofill service, we recommend that you use a test service when testing your app
关于android - 如何在没有 AccountManager 或权限的情况下在 EditText 上显示用户电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52167977/