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" />
Related
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"
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.
I am making an Android app and want the done key to show up on the keyboard when the user is typing into the keyboard.
This is the XML code for the EditText:
<EditText
android:id="#+id/answer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:layout_marginBottom="113dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:imeOptions="actionDone"
/>
I thought that adding the android:imeOptions="actionsDone would have the done button appear, but instead the enter button is there and when it is pressed, a new line is created in the EditText. What is the issue?
You will not get done by adding imeOptions.
Add the below attribute to your EditText:
android:singleLine="true"
This will make your EditText a single line and you will see the Done button if that is the only EditText or last EditText. If there are multiple EditText items, then you will see Next button.
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
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.