Android Webview : Display numberpad?
I implemented a WebView in my android app displaying a开发者_JAVA百科 web form. One of the fields ask for the user to manually enter his phone number (in case the phone does not allow extracting of phone number).
Right now, the qwerty soft keyboard pops up when user selects the field. Is there a way I can have the numberpad display instead?
(Remember I'm using HTML and not native controls)
Thanks! Shaun
just use <input type="number />
in a form, that will bring up the number keypad
There is an HTML input type specially for phone numbers for that you should use
<input type="tel" />
I have just start programming Android so I don't know If I will be able to help. First of all, the only place in which you can see numeric keypad in android is in the call application. Any other keyboard is standard qwerty (or swype or any other you have installed), even if you are filling a number field. That made me think that numeric keyboard is a call application implementation and is part of that application, so it is not accessible any other way. I'm almost sure it works that way. Therefore if you want numeric keyboard only I think the only way is to implement your own numeric keyboard and connect the key pressed to the add text events of WebView. You just need 10 buttons so it should´n be very complicated. You may be able to override the input method for your application only but as I say I'm pretty new in Android so I don't know how to do that.
精彩评论