I ran into a pretty puzzle and could not find a solution. Obviously, JellyBean is changing the way IME actions are handled. I found many websites offering a solution that really works, but only for single-line EditTexts . Example: stack overflow.
My EditText widgets worked fine before JellyBean. This will correctly wrap words until the user presses the Finish key (return). Then he caught the event using OnEditorActionListener and processed accordingly. I tried several options for changing the settings with the following XML attributes: [/ p>
- singleLined
- scrollHorizontally
- inputType
- imeOptions
- the lines
I could only get word wrapping without triggering the onEditorAction event or without word wrapping when the onEditorAction event was fired. How can I get a wrapping word and control a softkey enter key at the same time for JellyBean?
Update 1: Including the requested code. Please note that this works now, which works on all platforms except JellyBean. As I said earlier, I tried several different XML settings to no avail.
Update 2: Managed to hold Asus Transformer with JellyBean 4.1.1. Works great. So maybe this is a device error? My other JellyBean device is the Nexus 7, which runs on 4.1.2. Can anyone confirm this with other devices?
the code:
private class OnMyEditorActionListener implements OnEditorActionListener { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { 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:imeOptions="actionGo" android:inputType="textMultiLine|textNoSuggestions" android:padding="@dimen/spacing_half" android:textSize="24sp" > </EditText>
source share