Android中设定EditText的输入长度

it2026-02-19  18

方法一:可以在layout xml中加上属性android:maxLength 比如: <EditText         android:id="@+id/editTextShow"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="@string/hint"         android:cursorVisible="false"         android:lines="1"         android:maxLength="16"         />   方法二:在代码中控制 editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(20)});

转载于:https://www.cnblogs.com/akiha/p/5889338.html

相关资源:数据结构—成绩单生成器
最新回复(0)