I am using the following element in the Android EditText, to have a keyboard with number and decimal for displaying a keyboard layout for amount input (for eg 22.12).
android:inputType="numberDecimal"
It is working for all devices, like Samsung, Nexus, Sony etc.
The keyboard layout looks like below.
The keyboard layout on the LG G4 looks like below.
Could anyone please help, how to have decimal keyboard for the LG G4. I have already tried the android:inputType="phone"
, still same issue.
I would like to stick to the decimal input, as it would not be very nice to have a full alpha-numeric keyboard, to enter amount.
Thanks in advance.
Tap Settings > General tab > Language & input > On-screen keyboard > LG Keyboard > Keyboard height and layout. Allows you to change voice input, handwriting and symbol keys, to the left and right of the space bar for quick access.
Tap and hold the Numbers/Symbols Key . Tap Input language & type > Settings . Tap QWERTY keyboard, Phone keyboard, Handwriting, or Shape writer.
UPDATE It seems that flag signed is not needed after all to get decimal separator, It was actually the TYPE_TEXT_FLAG_NO_SUGGESTIONS that messed up the keyboard so do not use it with number input types. Also noticed that LG keyboard looks different depending on if you set the input type from code vs. XML END UPDATE
It seems like the combination of inputType and digits solves the problem. I have a class that extends EditText so I initialize the EditText like this:
setKeyListener(DigitsKeyListener.getInstance("0123456789.,"));
setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
I guess that because LG has bundled decimal separator and minus sign in a same button you have to configure both feature on and then disable "-" by not including it in digits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With