[英]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.