简体   繁体   English

如何将键盘上的自动建议代码粘贴到不同的文本输入字段中-Android

[英]How to paste autosuggested code from keyboard in different textinput field -Android

Currently, the issue is clicking on autosuggested text only filling the first textinput box, I want to fill all the six text inputs with the suggested code目前,问题是点击自动建议的文本只填充第一个文本输入框,我想用建议的代码填充所有六个文本输入

Autosuggested Keyboard screen shot:自动建议的键盘屏幕截图: 在此处输入图像描述

On clicking the autosuggested text, it is only filling first单击自动建议的文本时,它只是先填充

在此处输入图像描述

Expected behaviour is to fill all the textinputs once user clicks on autosuggested code预期行为是在用户单击自动建议代码后填充所有文本输入

This is a less explored use-case on StackOverflow, but, when you read Android docs for Auto-fill, in the OTP section, they have already provided generateSmsOtpHintForCharacterPosition which states and I quote:这是 StackOverflow 上探索较少的用例,但是,当您阅读 Android 文档以进行自动填充时,在OTP部分中,他们已经提供了generateSmsOtpHintForCharacterPosition ,其中声明并引用:

When using multiple views where each view maps to a single digit of the OTP, you can use the generateSmsOptHintForCharacterPosition() method to generate per-character hints.当使用多个视图时,每个视图映射到 OTP 的单个数字,您可以使用 generateSmsOptHintForCharacterPosition() 方法生成每个字符的提示。

You can utilize the characterPosition parameter to auto-fill each EditText with the respective digit of the OTP auto-filled.您可以利用characterPosition参数使用自动填充的 OTP 的相应数字自动填充每个EditText

To do that, set为此,请设置

//Where Character Position (int) represents the digit position of the OTP for respective EditText, ranges from 1 to 8.
android:autofillHint="smsOTPCode{characterPosition}"

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

相关问题 如何在测试Android studio中用键盘粘贴 - How to paste with keyboard in test Android studio 有没有办法在颤动的 webview 文本输入字段中自动对焦键盘? - Is there a way to autofocus keyboard in webview textinput field in flutter? React Native android TextInput 无法显示键盘 - React Native android TextInput fail to show keyboard React Native Keyboard 涵盖 Android 上的 TextInput KeyboardAvoidingView - React Native Keyboard covers TextInput KeyboardAvoidingView on Android 在 Android Kivy 上隐藏时将键盘绑定到 TextInput - Bind Keyboard to TextInput while it is hidden on Android Kivy Android - 如何禁用软键盘顶部的粘贴建议 - Android - How to disable the paste suggestion on top of the soft keyboard 如何在react-native中将TextInput附加到键盘 - How to attach TextInput to the keyboard in react-native 如何从本机代码强制打开Android软键盘? - How to Force Android Soft Keyboard Open from Native Code? React Native android:如何在按下“actionNext”键盘按钮后选择下一个TextInput? - React Native android: How to select the next TextInput after pressing the “actionNext” keyboard button? 在本机响应中在TextInput字段之外单击时失去焦点并关闭键盘? - Lose focus and dismiss keyboard on clicking outside of the TextInput field in react native?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM