I set imeoptions="actionDone" for my EditText in xml and everything works fine on a Medion Lifetab or Nexus 4 (on press "Enter" the softkeyboard disappears).
But I need this to work on a Honeywell Dolphin e70. On this device if I press "Enter" the next EditText gets focus. I already tried to set singleline true but didnt change the behavior.
This is the EditText I use:
<EditText
android:id="#+id/id1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".55"
android:imeOptions="actionDone"
android:inputType="textCapSentences"
android:selectAllOnFocus="true"
android:textSize="#dimen/dimen1" />
Like I said, on other devices it works like intended.. Anyone got an idea for a workaround or where I can start handling this? I definetly dont want to set a keylistener to EVERY damn EditText is the application, that would totaly be an overkill..
thanks
You can see Close/hide the Android Soft Keyboard to hide the keyboard and Android Use Done button on Keyboard to click button to catch the dome button action.
Related
I want the soft keyboard in my app to show Done when clicking on a particular EditText. This is how it looks
<EditText
android:id="#+id/code_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/enter_code_textView"
android:layout_marginStart="#dimen/margin_25dp"
android:layout_marginLeft="#dimen/margin_25dp"
android:layout_marginTop="#dimen/margin_12dp"
android:layout_marginEnd="#dimen/margin_25dp"
android:layout_marginRight="#dimen/margin_25dp"
android:background="#drawable/edittext_background"
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionDone"
android:textColor="#color/black"
android:textCursorDrawable="#null"
android:textSize="16sp" />
But this doesn't work. The soft keyboard enter key text doesn't change at all. I tried this on multiple devices, one Oreo and one KitKat. I also tried using singleLine attribute but that doesn't work too. What am I missing here? Thanks in advance!
There's no way to force the soft keyboard to show any key, not even the imeOptions. The keyboard app uses that as a hint- it doesn't have to honor it. And remember that every different keyboard will make different choices on whether or not to honor it. And that there is no such thing as the "default keyboard" as many OEMs replace it. Basically, you can set the imeOptions and hope it works, but there's no way to force it to work across all devices and keyboard apps.
I have a ListView which contains EditTextas items and also EditText in ListView header.
When I tap on any EditText it shows the keyboard and allows me to enter text. But if I press the back button, it hides the keyboard and then tap on the EditText which was previously focused, does not open the keyboard.
Here is my EditText declared in xml
<EditText
android:id="#+id/ui_row_create_poll_edit_text_txt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_toLeftOf="#id/ui_row_create_task_user_info"
android:background="#android:color/transparent"
android:imeOptions="actionNext"
android:maxLength="#integer/task_length"
android:maxLines="1"
android:paddingBottom="#dimen/padding_large_plus_little"
android:paddingLeft="#dimen/padding_large_plus_little"
android:paddingTop="#dimen/padding_large_plus_little"
android:textColor="#color/black"
android:textSize="#dimen/font_very_large" />
I have tried added onFocusedchanged listener and onTouchListener but it doesn't work.
I have also tried to add the onClickListener and added the following code to display keyboard forcefully but this does not work either.
InputMethodManager inputMethodManager = (InputMethodManager) context.
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInputFromInputMethod(windowToken, 0);
It works fine on < Android-7.0, but causes problem in API 24.
Is there any specific changes in Android 7.0 related to EditText? Or can somebody come up with some solution?
Note: I am facing this issue only on Android-7.0. On previous version it works fine.
Also I have faced another issue which is also only occurring on 7.0
I am answering my question to close this issue. I just received an update patch for Android 7.0 and now it is working fine. It seems like it was a bug in 7.0 which is resolved in security path 5th October 2016.
I use EditText to do input actions, and set android:imeOptions="actionSend" to the widget, so that the soft keyboard can have a send button, but when I click send, the soft keyboard will disappeared, however, it's not friendly to users since user must click EditText again to use the soft keyboard, all I want is to keep the soft keyboard, does any one know how to achieve it?
Here is a piece of my layout codeļ¼
<EditText
android:id="#+id/input_area"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#id/emo_btn"
android:inputType="textAutoCorrect"
android:singleLine="true"
android:imeOptions="actionSend"/>
you are using setOnEditorActionListener or setOnKeyListener ? on both case try your return statement with true
i have several EditText in my App. If you hit the Enter Key you can tab to the next EditText without a problem but i would like to change the Enter Key so that this button doesn't shows the Enter Simbol but instead it shows "Next" or "Done". i tried many things but without any results. Here is the XML code for my EditText:
<EditText
android:id="#+id/et_nt_name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top"
android:imeOptions="actionNext|flagNoEnterAction"
android:imeActionLabel="Next"
android:singleLine="true"
android:inputType="textShortMessage"
/>
it is the case that some soft keyboards actually change the default text on the enter key by design, so it may not be your fault that it's not showing what you want it to show. the functionality should be the what you programmed it to do, though.
i recommend you switch to the default keyboard (long press on any edit text, then select input method) to verify that it's showing the correct text, and don't care about the what the other soft keyboards look like .
if your phone didn't come with the default soft keyboard, the Android emulator is your best friend.
Add this to your EditText,
android:imeOptions="actionDone"
I'm having a problem with an EditText (only on QVGA devices, I've tested it on the QVGA emulator and on a Samsung i5500).
When the user clicks on the EditText and the soft keyboard comes up, only the first letter that the user enters appears on the field. The others only show up when the user closes the keyboard or some other event happens.
I don't know if this is a bug (it works on the higher res emulator), but is there any workaround I can use to give a better experience to my users right now?
My (messy) code is here:
https://github.com/bani/SMS-Denuncia/tree/master/android/
And the EditText I'm having a problem with is at
https://github.com/bani/SMS-Denuncia/blob/master/android/res/layout/local.xml
<EditText android:id="#+id/vagao2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="12"
android:textSize="18sp"
android:text=""
android:imeOptions="actionSend"
android:visibility="invisible" />
Somehow it got fixed when I surrounded my layout with ScrollView.