editText { hint = ctx.resources.getText(R.string.user_phone_etid) textSize = 14f setBackgroundColor(0) isFocusable = true textColor = ctx.color(R.color.text_black) inputType = InputType.TYPE_CLASS_PHONE filters = Array<InputFilter>(1) { InputFilter.LengthFilter(11) } }.lparams(matchParent, dip(55)) { alignParentLeft() centerVertically() }
通过filters = Array<InputFilter>(1) {
InputFilter.LengthFilter(10)
}来限制editView输入的长度