Done button does not appear on Android soft keyboard - android

I am defining the EditText as below. I want the Done button to appear in the soft keyboard but I am getting Return button instead.
<EditText
android:id="#+id/txtCommentContent"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_margin="5dp"
android:background="#drawable/bg_edittext_gradient"
android:gravity="top|start"
android:hint="#string/strHintContentComment"
android:maxLines ="4"
android:imeOptions="actionDone"
android:padding="5dp"
android:textSize="15sp"
android:textColor="#color/black"
android:scrollHorizontally="false"/>
Can anyone point out what I am doing wrong?

Did you try?
editText.setImeOptions(editText.getImeOptions()| EditorInfo.IME_ACTION_DONE);
With
android:inputType="text"

You need to add:
android:singleLine="true"
done button will show, but you can not use done button and return button(next line) same time on softkeyboard

Related

NumberPad Keyboard without text preview

My question is simple: I want to show a NumberPad keyboard on my android app without text preview and "Done" button. Just like the keypad that is shown on WhatsApp when user submits his phone number.
I hope the answer would be a simple one too! :)
You should try with textNoSuggestions
android:inputType="textNoSuggestions"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="numberPassword"
android:maxLength="10"
android:maxLines="1"
android:padding="10dp"
android:singleLine="true"
android:textColor="#android:color/black" />
android:inputType="numberPassword"

How to show the enter button in keyboard after adding textNoSuggestions to editText?

Basically I'm trying to remove the suggestion underline from the editText and which is done by textNoSuggestions in editText . But now the problem is keyboard is not showing the enter button . So, I wonder how to show the enterKey even after adding the flag ?
Code:
<EditText
android:id="#+id/editTxt"
android:textColor="#001919"
android:gravity="start|top"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textCursorDrawable="#null"
android:background="#fff"/>
Try this,
<EditText
android:id="#+id/editTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:gravity="start|top"
android:inputType="textNoSuggestions|textMultiLine"
android:singleLine="false"
android:textColor="#001919"
android:textCursorDrawable="#null" />

Android Softkeyboard "Done" key gone

I'm making an APP and want to change the keyboard "Line Break" key into a "Done" key, But I cant use the android:signleLine="true" (seen here: Done key not showing up on keyboard) because the EditText isn't the last EditText in my code.
What could I use/do instead?
Thanks.
Edit
Here is my code:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:width="40dp"
android:maxLength="1"
android:lines="1"
android:textStyle="bold"
android:inputType="textCapCharacters|textFilter"
android:digits="ABCDEFGHIJKLMNOPQRSTUVXYZ"
android:textAlignment="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"/>
You can use to set the keyboard action button imeOptions
<EditText
android:id="#+id/search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/search_hint"
android:inputType="text"
android:imeOptions="actionDone" />
Read more about imeOptions here
You will also have to remove the line
android:digits="ABC..."
as imeOptions do not work well with this.
You can Try this.
By XML
android:imeOptions="actionDone"
By Java
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
this may helps you.

EditText Next Focus is not woking

I have few EditText in a same screen. Next soft key button is not there. Enter soft key is there but, it was not going to next EditText whenever I am pressing on that button. And after last EditText reached, I want to hide the soft keyboard. What should I do to achieve that. I found many questions and solution in stackoverflow. Nothing working for me.
Edittext Code:
<EditText
android:id="#+id/vehicle_number"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:imeOptions="flagNoExtractUi|actionNext|actionGo|actionDone"
android:paddingLeft="5dp"
android:textSize="25dp"
android:maxLength="12"
android:hint="GA-00-A0000"
android:digits="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
android:nextFocusForward="#+id/vehicle_color"
android:inputType="textCapCharacters"
android:background="#drawable/edittext_rect_yellow_border" />
Tried java code also,
vehicle_number.setNextFocusDownId(R.id.vehicle_color);
I fixed myself. The solution is below. Now the 'Next' soft key displaying.
Removed
android:inputType="textCapCharacters"
Added
android:maxLines="1"
android:singleLine="true"
For Capital Characters
vehicle_number.setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
Solution
<EditText
android:id="#+id/vehicle_number"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:imeOptions="flagNoExtractUi"
android:paddingLeft="5dp"
android:textSize="25dp"
android:maxLength="12"
android:hint="GA-00-A0000"
android:maxLines="1"
android:singleLine="true"
android:digits="1234567890qwertyuioplkjhgfdsazxcvbnm-"
android:background="#drawable/edittext_rect_yellow_border" />

android - imeOptions have search button say "Search" instead of magnifying glass

I was wondering if its possible to change magnifying glass on the Search button to text "Search". We want to preserve the imeOptions setting to android:imeOptions="actionSearch" because we respond to a certain event.
Here is what I have:
<EditText
android:id="#+id/txtSearch"
android:textSize="14px"
android:textColor="#color/main_text_black"
android:layout_width="189px"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="24px"/>
Tried this:
<EditText
android:id="#+id/txtSearch"
android:textSize="18dp"
android:textColor="#color/main_text_black"
android:layout_width="247dp"
android:layout_height="fill_parent"
android:imeOptions="actionSearch"
android:imeActionLabel="Search"
android:gravity="center_vertical"
android:singleLine="true"
android:background="#null"
android:layout_alignParentLeft="true"
android:layout_marginLeft="38dp"/>
This only works in landscape mode which our app does not support and the word Search shows up in the wrong place.
You can try it!
<EditText
android:id="#+id/edt_search_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"/>
No, this is impossible unless you implement your own Keyboard for that EditText. The Text (or icons) on the keys of a keyboard is controlled by the person who wrote the keyboard.

Categories

Resources