Skip to content

Instantly share code, notes, and snippets.

@dominicthomas
Created December 22, 2014 11:03
Show Gist options
  • Save dominicthomas/c5b5d0f2cbd0ccdb04ba to your computer and use it in GitHub Desktop.
Save dominicthomas/c5b5d0f2cbd0ccdb04ba to your computer and use it in GitHub Desktop.
One simple way of setting and firing an IME action on a multiline EditText. Google have stopped IME actions firing on multiline text input fields, has enter should be reserved in these cases to move the user to the next line. See: http://stackoverflow.com/questions/13239225/how-to-get-edittext-ime-action-textmultiline-to-work-for-jellybean && ht…
private class OnMyEditorActionListener implements OnEditorActionListener {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == R.id.your_new_ID || actionId = EditorInfo.IME_Null) {
doSomething();
return true;
}
return false;
}
}
<EditText
android:id="@+id/editbox_box_et"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@null"
android:gravity="top|center_horizontal"
android:inputType="textMultiLine|textNoSuggestions"
android:padding="@dimen/spacing_half"
android:textSize="24sp"
android:imeActionId="@+id/your_new_ID"
android:imeActionLabel="Go">
</EditText>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment