Помимо упомянутых инструкций мне также нужно было указать уровень языка для каждого модуля. Файл -> Структура проекта -> Модули
Это должно сработать:
yourEditTextHere.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (event != null&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// NOTE: In the author's example, he uses an identifier
// called searchBar. If setting this code on your EditText
// then use v.getWindowToken() as a reference to your
// EditText is passed into this callback as a TextView
in.hideSoftInputFromWindow(searchBar
.getApplicationWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
userValidateEntry();
// Must return true here to consume event
return true;
}
return false;
}
});
Если вы сделаете текстовое поле одной строкой (я считаю, что свойство называется SingleLine в XML-файлах макета), оно выйдет из клавиатуры при вводе.
Итак: http://developer.android.com/reference/android/R.styleable.html#TextView_singleLine