asaf
asaf

Reputation: 976

Add comma in numeric keyboard in xamarin.forms for android

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 ?

Upvotes: 0

Views: 4988

Answers (2)

Elvis Xia - MSFT
Elvis Xia - MSFT

Reputation: 10831

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.

Upvotes: 1

user1230268
user1230268

Reputation: 221

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

Upvotes: 2

Related Questions