1. Only letters, numbers, and underscores can be entered in the restricted editing box. Method 1: <EditText android: dights = "success _"/> problematic Method 2: InputFilter, but Character. isLetterOrDigit also regards Chinese as Letter, so this method cannot be limited to Chinese input. InputFilter filter = new InputFilter () {public CharSequence filter (CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {for (int I = start; I <end; I ++) {if (! Character. isLetterOrDigit (source. charAt (I ))&&! Character. toString (source. charAt (I). equals ("_")&&! Character. toString (source. charAt (I )). equals ("-") {return "" ;}} return null ;}; 2. restrict the number of words in the edit box. Method 1: Use android in xml: method 2: Use LengthFilter to dynamically limit editText. setFilters (new InputFilter [] {new InputFilter. lengthFilter (MAX_LENGTH)}); 3. When using the word input limit display control, you only need to add the EditTextLengthIndicate control to the xml file and add editTextLengthIndicate to the code. bindEditText (editText, length) dynamically displays the red area information in the graph on the interface, indicating the user's input operations. The Code is as follows/*** inherited from TextView, used to display the number of words currently entered in the specified text box */public class EditTextLengthIndicate extends TextView {private EditText mEditText; private int mMaxLength; public void bindEditText (EditText et, int maxLength) {mEditText = et; mMaxLength = maxLength; setText (et. getText (). length () + "/" + mMaxLength); if (et! = Null & maxLength> 0) {et. addTextChangedListener (new TextWatcher () {@ Override public void onTextChanged (CharSequence s, int start, int before, int count) {// TODO Auto-generated method stub String str = s. toString (); int length = str. length (); setText (length + "/" + mMaxLength );}});}}}