I want to have a TextField in a form which should only allow positive numbers and no decimals. I tried different keyboard (number,phone) types but there is none that supports my need. Is it possible to customize the same in nativescript?
You can use any input format listed in official android docs.
make sure you run this code only for Android.
This allows entering decimal values as well. I just want to enter whole numbers
I think Android doesn’t have a built-in keyboard that prevents decimal. But setting a key listener seems to prevent dots.
This will still show the dot in keyboard, but will be ignored even if user hits it.
Sorry. It was my mistake since i was getting exception in AfterViewInit method.
._setInputType(2) also prevents dot from being entered, but it still appears on keyboard.
Thanks. I was otherwise planning to do validation using directive. You saved my time