Android 用户名自动填充提示

问题描述 投票:0回答:2
android autofill password-manager
2个回答
0
投票

您的代码似乎没问题,但是,自动填充可能无法按预期工作的原因可能有几个:

  1. Android 版本:根据您的设备运行的 Android 版本,启用自动填充的方法有不同。
  2. 设备特定设置:某些设备可能需要启用设备特定设置才能使自动填充功能发挥作用。
  3. 电池优化设置:Android 电池优化设置将自动关闭服务(如辅助服务)以节省电池。

尝试在 XML 中设置输入类型:

<EditText
    android:id="@+id/username"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:importantForAutofill="yes"
    android:inputType="textEmailAddress"
    android:minWidth="200dp"
    app:layout_constraintBottom_toTopOf="@id/password"
    app:layout_constraintStart_toStartOf="@id/password" />

您可以尝试为每个字段使用单个特定的自动填充提示。


0
投票

您正在使用AUTOFILL_HINT_USERNAME。您也可以尝试在用户名字段中使用 AUTOFILL_HINT_GENERICAUTOFILL_HINT_TEXT 看看是否有任何影响

© www.soinside.com 2019 - 2024. All rights reserved.