0

I need to use both comma and dot in the numeric keyboard in android in xamarin.forms.

I am testing on Samsung S7.

when defining the

Keyboard = Keyboard.Numeric

in xamarin.forms I can only see dot with the numbers.

I tried custom renderer with:

protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) { base.OnElementChanged(e); InputTypes its = InputTypes.ClassNumber | InputTypes.NumberFlagSigned | InputTypes.NumberFlagDecimal; Control.SetRawInputType(its); }

but I see the dot with the - sign, no comma

Any ideas ?

asaf
  • 958
  • 1
  • 16
  • 38

2 Answers2

2

try phone number as input type. it is the only numeric keyboard type out of the box that offers point and comma.

user1230268
  • 221
  • 2
  • 14
  • there is no difference on samsung devices. phone will not work as well – Emil Aug 15 '19 at 20:36
  • Keyboard="Telephone" looks a bit weird if you expect the user to enter a numeric value. Telephone keyboard not only shows keypad numbers 0-9 but also the oldschool alphabetic characters on each keypad.... this could be very confusing if the user is expected to enter e.g. an amount – thomasgalliker Jun 29 '20 at 12:56
1

I need to use both comma and dot in the numeric keyboard in android in xamarin.forms.

As far as I know, it's not possible to add comma to the default numberic keyboard.

And, the style of software keyboard is not always the same depending on different android system.

For example, I made a demo from your codes and tested it on Google Emulator(Android 6.0) the keyboard shows like below:

enter image description here

As you can see, there is a comma on the keyboard.

So the only solution I can think of that fullfills your requirement is to create a custom keyboard. For this solution, you can refer to this case.

Community
  • 1
  • 1
Elvis Xia - MSFT
  • 10,801
  • 1
  • 13
  • 24