I have an EditText control for currency input, however, as everybody knows, Android does not replace the decimal separator in the keyboard like the users locale.
So I'm thinking on creating a dialog to edit this value, like a calculator. This way I won't have an EditText, but a TextView with a numeric soft keyboard.
Do you know any numeric keyboard control that I can plug into my dialog? Or maybe a solution to this Android gap?
For similar problem, I used:
android:inputType="date"
in xml layout for EditText. This gave me a numeric soft keyboard like calculator. Hope this helps.
Related
I have an EditText box and I want the default keyboard that comes up when it is selected to be the numeric keypad. However, I do want to allow users to enter alphabetic characters too. The solutions android:inputType="number" , et.setRawInputType(InputType.TYPE_CLASS_NUMBER)...etc does not work for me because restricts input to numeric digits only. Does someone know some solution??
Add the following line of code, and it will do the trick :)
editText.setRawInputType(Configuration.KEYBOARD_QWERTY);
This will show the the numeric keypad first, but also allows you to enter free text.
More information tap here
This problem is similar to the this.
My application has two requirements where one screen is an numeric entry and other has an search option. Since user has to use the numeric keyboard most of the time he has to change the input type of edit text and select the keyboard. Is there any way i could start a numeric keyboard for one activity and charater keyboard when other activty starts
Sebs
hiii,,,
Use for the edit text that should open a numeric keypad with following property:
android:inputType="phone"
And android:imeOptions="actionSearch" for other activity Edit Text xml layout
Hope you would be able to get what I mean to convey
With Regards,
Arpit Garg
To just get a numeric keyboard the user should not have to longpress and choose input type. That would be only if they are trying to change which actual keyboard application they are using, for instance switching from Android Keyboard to Swype keyboard. All of the different configurations of keys are all part of each keyboard separately. So the Android keyboard contains a qwerty keyboard, a number keyboard (which has numbers across the top row and symbols on all the other keys) and a Number pad keyboard (9x9 block of numbers like the numpad on your PC, or an old telephone). To tell the system which you'd like to use you just have to specify the inputType for your EditText.
this page will show you possible types
this question will show you how to set it from xml
Is it possible to have Android's numeric keypad display for an EditText (the one that would show with inputType="number"), while still having an option for users to switch back to the normal QWERTY keyboard?
My input field will usually be a number, but there will be times when text is necessary so I'd like to make it very easy to enter numbers, and extremely simple to switch over to entering text.
Thanks!
Yes, you can programatically change the keyboard being used by using the setInputType() method. So for instance, you could add a button in your UI that changes the input type from just pure numbers to a full on QWERTY keyboard.
Try this. It should leave the button on the on-screen keyboard that lets you toggle between letters and numbers.
In xml, don't constrain the input--just leave it to the default of letters. (Not sure if this matters.)
mEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
how do i make it so that when focus is brought to an input text field in my application that the numpad keyboard with the 9 number keys on them opens rather than the full qwerty keyboard?
Set the input type of your EditText view to this:
android:inputType="number"
Or a related type based on your requirements
You must only add this line on your code:
input.setRawInputType(Configuration.KEYBOARD_12KEY);
this will show de 12 key keyboard more or less what you want, isn't it?
I have an EditText field for the user to enter their weight in lbs. How can I override the traditional keyboard and display the numeric keypad instead?
This didn't work for me. However, I was able to accomplish the aforementioned by either of the following lines:
// TYPE_CLASS_NUMBER: Class for numeric text. This displays the numbers/symbols keyboard.
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
// TYPE_CLASS_PHONE: Class for a phone number. This displays the phone number keypad.
editText.setInputType(InputType.TYPE_CLASS_PHONE);
This is what i pulled off of the google API
//Set the input style to numbers, rather than qwerty keyboard style.
txtView.setInputMethod(DigitsInputMethod.getInstance());