最近我观察到在少数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