How can I change EditText keyboard enter key like this ?
The solution for me was adding these two lines in the XML of Edittext
android:imeOptions="actionDone"
android:inputType="text"
Thx everyone.
Android have "android:imeOptions" to specify the keyboard action button
1. android:imeOptions="actionGo"
2. android:imeOptions="actionDone"
3. android:imeOptions="actionNext"
4. android:imeOptions="actionPrevious"
5. android:imeOptions="actionSend"
...and more,
you can use based on requirement
Try using android:imeOptions with your EditText in your layout file:
android:imeOptions="actionGo"
use this in your xml where you have define your edittext android:imeOptions="actionDone"
Related
It's possible to set or add numeric keyboard without +, -, . sign in android app?
I want only 0-9, backspace and enter keys?
I tried with
inputType="number"
setRawInputType(InputType.TYPE_CLASS_NUMBER)
but it doesn't work.
Try to add this line on your code:
input.setRawInputType(Configuration.KEYBOARD_12KEY);
this will show only the numeric keyboard.
android:inputType="number"
Just use this line your XML file
For Example In my Edit Text
<EditText
android:id="#+id/edtMobileNo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/btnSignup"
android:layout_centerVertical="true"
android:background="#drawable/background_edittext"
android:drawableLeft="#drawable/username_icon"
android:hint="#string/mobile_no_hint"
android:inputType="number"
android:maxLength="10"
/>
I tried setting android:imeOptions to actionSend, actionSearch. But there's no "Send" or "Search" button on the keyboard, just usual "Enter" key. I also tried setting different input types. (I'm working with HTC Sensation XL.) What's wrong?
I'd suggest switching your EditText to singleLine mode
Currently in Android Studio 2.2.3 if you use
android:singleLine="true"
IDE gives a warning that it has been deprecated use maxlines instead.
android:maxLines="1"
However maxLines does not solve the problem. The solution is to just add the attribute inputType. Example :
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/actionDoneDemo"
android:layout_below="#id/nameET"
android:imeOptions="actionDone"
android:hint="Action Done Demo"
android:inputType="text"/>
Try these actionDone imeOption doesn't work on EditText in Android 2.3
if it is not supported read How do I handle ImeOptions' done button click?. May be the HTC implemented their own soft keyboard which ignores the imeOptions
Just do in xml:
<EditText android:imeOptions="actionSearch"
android:inputType="text"/>
Happy Coding!!
I created many emulators but i did not get 'Done' button on emulator.any ideas to solve this problem?
I have attached the screenshot Emulator' Screenshot
Just add two lines in xml:
android:imeOptions="actionDone"
android:singleLine="true"
Done
Try adding android:imeOptions="actionDone" to your EditText.
android:singleLine="true" has been deprecated. Alternatively you could use this:
android:inputType="text"
android:maxLines="1"
I read several other posts and using input.setInputType(TYPE_NUMBER_FLAG_DECIMAL); does open the keyboard but its not the numeric keyboard
add android:inputType="number" to your edittext in your xml, it will automatically open numeric keyboard when you will click inside edittext.
Add android:inputType="number" in xml will automatically open numeric keyboard when click on EditText, but this will allow you to enter characters only numbers, and if you wanna enter other characters, you may try this:
android:inputType="number"
android:digits="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
You can add the following to your EditText block in XML file:
android:inputType="phone"
android:digits="1234567890"
OR
android:inputType="number"
Add this line in your edittext xml, clean build and run it. It should works.
android:inputType="number"
I've the following EditText which it's characters need to be hidden as it is a password. I can do this with the following.
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Please Enter Password/Pin"
android:inputType="textPassword"
>
I would like to set the keyboard to numeric as all passwords are numbers, but when i do the following the numbers are displayed. How can i acheive both?
passwordPin = (EditText)findViewById(R.id.password);
passwordPin.setInputType(InputType.TYPE_CLASS_NUMBER);
Try this.
android:inputType="textPassword|number"
Try the following line for EditText
android:inputType="textPassword|number"
Looking through Eclipse, you can also use the following, not sure how backwards compatible it is however.
android:inputType="numberPassword"
Solved.
android:inputType="textPassword|number"
android:password="true"
You can do it programmatically as long as password is now deprecated. Try this:
passwordPin = (EditText)findViewById(R.id.password);
passwordPin.setInputType(InputType.TYPE_CLASS_NUMBER);
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
I ran into this same requirement and solved it this way:
In XML:
android:inputType="number|numberPassword"
Programmatically:
editText.setInputType(InputType.TYPE_CLASS_NUMBER || InputType.TYPE_NUMBER_VARIATION_PASSWORD)
Hope this helps :D