VerificationCodeInput icon indicating copy to clipboard operation
VerificationCodeInput copied to clipboard

有没有直接settext()的方法?

Open z2700589 opened this issue 7 years ago • 1 comments

如题

z2700589 avatar Jun 21 '18 09:06 z2700589

遍历每个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}") } }

ZevShiShi avatar May 13 '20 09:05 ZevShiShi