如何在 Android 应用程序组合中启用键盘中扫描新卡选项的选项

问题描述 投票:0回答:0

最近我观察到在少数Android应用程序中点击信用卡输入字段时,有一个“扫描新卡”选项,扫描后它会在输入字段中填充卡详细信息。我怎样才能在我的应用程序中进行撰写
我试过使用

autoFill
修饰符,但没有用。

    autofillTypes: List<AutofillType>,
    onFill: ((String) -> Unit),
) = composed {
    val autofill = LocalAutofill.current
    val autofillNode = AutofillNode(onFill = onFill, autofillTypes = autofillTypes)
    LocalAutofillTree.current += autofillNode

    this.onGloballyPositioned {
        autofillNode.boundingBox = it.boundsInWindow()
    }.onFocusChanged { focusState ->
        autofill?.run {
            if (focusState.isFocused) {
                requestAutofillForNode(autofillNode)
            } else {
                cancelAutofillForNode(autofillNode)
            }
        }
    }
}


Any idea on how can I achieve this ?
Sharing a screenshot of some other where I observed this
[![enter image description here][1]][1]


  [1]: https://i.stack.imgur.com/F11cV.jpg
android android-jetpack-compose credit-card
© www.soinside.com 2019 - 2024. All rights reserved.