9

When trying to work with a comma (,) as the decimal separator and inputType="numberDecimal" (or "number"), I have problem in smartphone in landscape mode, the comma is not showing.

My layout:

enter image description here

When I open the keyboard:

enter image description here

My EditText layout.

<EditText
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:digits="0123456789,"
 android:inputType="numberDecimal"
 android:text="5,2" />

And my default Locale is pt_BR, where the comma is the decimal separator.

In "tablets" is ok, because the keyboard is not full-screen.

enter image description here

If I remove android:inputType="numberDecimal", also is ok, but does not show the numeric keyboard.

Any suggestions?

EDIT #1

A partial solution I found was to add android:imeOptions="flagNoFullscreen".

EDIT #2

The comma is adopted by half the world. Why is it so hard on Android? :(

  • Possible duplicate of http://stackoverflow.com/questions/3821539/decimal-separator-comma-with-numberdecimal-inputtype-in-edittext – Noumenon Jun 27 '16 at 14:51
  • 1
    It is definitely not the answer. – Douglas Nassif Roma Junior Jun 27 '16 at 15:52
  • The `inputType` settings aren't localized at all, so it's the same set of characters regardless of your locale. Have you tried this with a different keyboard app? The full-screen input mode is owned by the keyboard. – Dan Hulme Jul 21 '16 at 12:43
  • Yes, tried with [SwiftKey](https://play.google.com/store/apps/details?id=com.touchtype.swiftkey) and [Google](https://play.google.com/store/apps/details?id=com.google.android.inputmethod.latin), the two most used of the PlayStore. (Device Moto X 2 and Android 6.0) – Douglas Nassif Roma Junior Jul 21 '16 at 13:21
  • I did not know the fullscreen mode was designed by the keyboard, the two that I have used are very much alike in the top half. – Douglas Nassif Roma Junior Jul 21 '16 at 13:23
  • I tried too with [ASUS Keyboard](https://play.google.com/store/apps/details?id=com.asus.ime) in Zenfone 5 and Android 4.4.2. – Douglas Nassif Roma Junior Jul 21 '16 at 13:25
  • This problem exists with decimal '.' as well, when typing in a number field it isn't displayed on landscape mode. It is actually entered it just isn't rendered in the edit control until you press done. – Paul Kiar Mar 09 '20 at 17:20

1 Answers1

0

android:inputType="numberDecimal" is for decimal inputs, it means all the digits from 0 to 9 including the decimal separator sign(.) can only be the input values. Comma is not the correct sign for the decimal separator. I think it may be a bug at your vendor not to produce all the correct localization values. You can try to use

<EditText
    android:inputType="number"
    android:digits="0123456789.,"/>
Evgeniy Mishustin
  • 3,343
  • 3
  • 42
  • 81
  • Thanks for the answer, but I had tried. It is the same problem with `number` :( ... strange thing is that the problem only occurs when open the keyboard in full screen. – Douglas Nassif Roma Junior Jun 27 '16 at 14:28
  • Specifying the digits doesn't make any difference. I have localized my edit control to use comma or decimal, neither are rendered. – Paul Kiar Mar 09 '20 at 17:24