1, EditText multi-line display
And supports imeOptions provided, and is provided imeOptions single-line display is very simple, in that in the xml singleLine set to true, the inputType to text, multi-line display the default is not set, the default is the Enter key.
XML
android:inputType=”text|textCapSentences”
JAVA
editText.setHorizontallyScrolling(false);
editText.setMaxLines(Integer.MAX_VALUE);
2, the keyboard monitor
No search button in the search, but the call button on the software disc. Implementation calls only needs to join in the XML input box android: imeOptions = "actionSearch", in addition, also set android: When singleLine = "true", click the guarantee will not wrap, and finally call the soft keyboard, the Enter key will show search word. Then call OnEditorActionListener, not OnKeyListener.
searchPatient.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
String search = searchPatient.getText().toString().trim();
initCaseControl(search);
return true;
}
return false;
}
});