user2033349
user2033349

Reputation: 175

How to change Enter by Done from keyboard in a textMultiline?

this is my editext:

EditText<br>
android:id="@+id/detailsText"<br>
android:layout_width="fill_parent"<br>
android:layout_height="wrap_content"<br>
android:inputType="textMultiLine"<br>
android:maxLength="500"/><br>

I have to hide the keyboard some how so y add this:
details.setOnEditorActionListener(new TextView.OnEditorActionListener() {

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {<br>
        if (event != null&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {<br>
          InputMethodManager imm = (InputMethodManager)getSystemService(
                  Context.INPUT_METHOD_SERVICE);<br>
            imm.hideSoftInputFromWindow(details.getWindowToken(), 0);
            return true;
        }<br>
        return false;
    }
});

When i press enter the keyboard get hide (that's what i want), but i need to change the arrow that the enter button have by default, I want to put something like "Done" and i cant change the android:inputType="textMultiLine" because the edit text change the size with the user input.

Upvotes: 1

Views: 1855

Answers (1)

Pragnani
Pragnani

Reputation: 20155

You can try this
android:imeOptions="actionDone" This will automatically hide the keyboard with done button, you don't need to manually write code for it.

Upvotes: 1

Related Questions