VerificationCodeInput
VerificationCodeInput copied to clipboard
有没有直接settext()的方法?
如题
遍历每个edittext,把字符串拆分一个一个settext()就可以了 fun setTextContent(text: String) { try { if (text.isEmpty()) return if (text.length == 6) { val chars = text.toCharArray() val arrays = StringBuilder() for (c in chars) { val s = c.toString().toInt() // LogUtils.d("VerificationCodeInputEx char===$s") arrays.append(s) } for (i in 0 until childCount) { if (getChildAt(i) is EditText) { val et = getChildAt(i) as EditText et.setText("${arrays[i]}") // LogUtils.d("VerificationCodeInputEx string===${arrays[i]}") } } } } catch (e: Exception) { LogUtils.e("VerificationCodeInputEx error===${e}") } }