简体   繁体   English

(Android) Google 不提供保存 Jetpack Compose 文本字段的密码

[英](Android) Google not offering to save password for Jetpack Compose Text Field

I had refactored a login flow from XML to Compose.我已将登录流程从 XML 重构为 Compose。

The old login flow, after logging in successfully, would have Google suggest to save your password.成功登录后,旧的登录流程会让 Google 建议保存您的密码。

在此处输入图像描述

However, since I refactored it, it doesn't do this anymore.但是,由于我重构了它,它不再这样做了。

The old XML layout just used a TextInputLayout and TextInputEditText .旧的 XML 布局只使用了TextInputLayoutTextInputEditText The new composable is just an OutlinedTextField with some keyboard options.新的可组合只是一个带有一些键盘选项的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>

    OutlinedTextField(
        keyboardOptions = KeyboardOptions(
            keyboardType = KeyboardType.Password,
            imeAction = ImeAction.Done
        )
    )

Why is Google not suggesting to save the password?为什么谷歌不建议保存密码? Both old and new code was run on the same emulator, which has auto fill services enabled.旧代码和新代码都在同一个模拟器上运行,该模拟器启用了自动填充服务。

There is limited autofill support in Compose UI 1.0.x . Compose UI 1.0.x 中的自动填充支持有限 With luck, this situation will improve in the coming years.幸运的是,这种情况在未来几年会有所改善。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM