Text field with numeric input

I have a text field which accepts only numeric input. That part was easy enough, but now I want to show the correct on-screen keyboard when that text field is selected.

Unfortunately the only way I can find to set the type of keyboard is to open it myself - I can’t find a way to set a default, I can’t find a way to get a reference to the automatically opened one to set its type, I’m unaware of a way to (nicely) find out if the text field has just got focus, and even if I could do that I’m unaware of a way to tell it not to open the (wrong) keyboard itself when that happens.

How do other people do this? It can’t really be hard, can it? At the moment the only solutions I can think of are pretty ugly - such as an invisible button over a label that’s styled after a text field which opens a keyboard of my choosing.

Ok, so I tried out the ugly solution as described above, and found that while it works none of the keyboard types available actually suit my needs anyway. So, I’ve now implemented a different solution.

Cheers for reading!