Recently developed a EditTextwith the Delete button, on the one hand need to set to Singleline, on the other hand, you need to set the input type, initially set in the XML file android:inputtype type, the setsingleline ()is set in the Java code of the custom control, the result shows that the effect is always the default input type, search results on the web, must be set after setsingleline () InputType. Several tests were followed and the following conclusions were drawn:
1. Setting android:singleline and android:inputtype in XML is absolutely no problem.
2. If you are creating EditText in Java code, you must call Edittext.setsingleline ()after AddView (EditText) , and then call the Edittext.setinputtype (InputType), in this case, can also get the single line and the desired input type.
<Android> about the conflict between Setinputtype and Setsingleline in EditText