为什么 Google 不提供保存 Jetpack Compose Text Field 密码的功能?

Sma*_*mer 6 android android-jetpack-compose

我将登录流程从 XML 重构为 Compose。

旧的登录流程在成功登录后,Google 会建议保存您的密码。

在此输入图像描述

然而,自从我重构它之后,它就不再这样做了。

旧的 XML 布局仅使用TextInputLayoutTextInputEditText。新的可组合项只是OutlinedTextField带有一些键盘选项。

<com.google.android.material.textfield.TextInputLayout
    style="@style/TextInputLayoutStyle"
    android:theme="@style/TextInputLayoutStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:passwordToggleEnabled="true"
    android:hint="@string/password">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:imeOptions="actionDone"
        android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
OutlinedTextField(
    keyboardOptions = KeyboardOptions(
        keyboardType = KeyboardType.Password,
        imeAction = ImeAction.Done
    )
)
Run Code Online (Sandbox Code Playgroud)

为什么 Google 不建议保存密码?新旧代码都在同一模拟器上运行,该模拟器启用了自动填充服务。

Com*_*are 3

Compose UI 1.0.x 中的自动填充支持有限。幸运的是,这种情况在未来几年将会得到改善。