Kotlin Anko布局 TextView和EditText限制字符长度

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(1) {
        InputFilter.LengthFilter(11)
    }

}.lparams(matchParent, dip(55)) {
    alignParentLeft()
    centerVertically()
}
通过filters = Array(1) {
    InputFilter.LengthFilter(10)
}来限制editView输入的长度

你可能感兴趣的:(anroid,anko,editview长度限制)