editText设置最大长度

xml中可以设置为:

<EditText android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:id = "@+id/mEdit"
android:maxLength = "10"/>

 

//手动设置maxLength为10
InputFilter[] filters = {new InputFilter.LengthFilter(10)};
et_rechargeFromWallet_count.setFilters(filters);

你可能感兴趣的:(EditText)