【问题标题】:How to integrate autofill in Jetpack Compose如何在 Jetpack Compose 中集成自动填充功能
【发布时间】:2021-09-22 09:14:15
【问题描述】:

我想在完全使用 Jetpack compose 编写的应用程序(电子邮件和密码)中提供一些自动填充功能。我遇到了this blog postthis demo code,我都试过了。不幸的是,在与文本字段交互时,我无法弹出任何窗口。

修改我的代码后,我最终使用了提供的演示。一个最小的示例如下所示(ExplicitAutofillTypesDemo 可组合来自上面提到的演示代码,未经任何修改):

class MainActivity: AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            ExplicitAutofillTypesDemo()
        }
    }
}

我错过了什么?我需要在其他地方启用它吗?官方compose autofill documentation 帮助不大。我只想在触摸上面博客文章中的文本字段时获得自动填充弹出窗口。

【问题讨论】:

    标签: android android-jetpack-compose android-autofill-manager


    【解决方案1】:

    在我的情况下,弹出窗口没有显示,因为自动填充似乎不适用于 Google 以外的任何其他提供商。调试日志显示以下消息:

    D/Autofill Status: Autofill popup isn't shown because autofill is not available.
        
        Did you set up autofill?
        1. Go to Settings > System > Languages&input > Advanced > Autofill Service
        2. Pick a service
        
        Did you add an account?
        1. Go to Settings > System > Languages&input > Advanced
        2. Click on the settings icon next to the Autofill Service
        3. Add your account
    

    我以 Microsoft Authenticator 为例进行了尝试,但它不起作用。当我切换到 Google 时,一切正常。

    【讨论】:

      猜你喜欢
      • 2022-10-22
      • 1970-01-01
      • 2022-12-03
      • 2015-07-08
      • 2022-11-01
      • 1970-01-01
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多