InputMethodManager秀的WebView小键盘 [英] InputMethodManager show numpad in webview

查看:194
本文介绍了InputMethodManager秀的WebView小键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是InputMethodManager以编程方式显示softkeyboard在需要时

I'm using the InputMethodManager to programmatically display the softkeyboard when it's needed

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, 0);

反正是有强制出现应运而生的号码或电话键盘键盘?

Is there anyway to force the keyboard that appears into being the Number or telephone keypad?

修改

对不起,我有急事类型在此之前,我不得不离开我的电脑一段时间。我忘了提及可能最关键的部分。我试图做到这一点在网页视图。我正在专注于文本框的输入类型设置为电话。出于某种原因,数字键盘将无法在自动对焦这就是为什么我想用InputMethodManager迫使它显示出来。我目前的方法显示似乎集中在正确的领域键盘,它只是不读的类型和正确显示。

Sorry I typed this in a hurry before I had to leave my computer for a while. I forgot to mention possibly the most crucial part. I'm trying to do this in a webview. The input type of the textbox i'm focusing on is set to tel. For some reason the numpad won't show up on autofocus which is why I'm trying to force it with InputMethodManager. My current method displays the keyboard focused on the correct field it just doesn't seem to read the type and display correctly.

感谢您的答案为止(这并回答我的措辞不佳的问题)。

Thanks for all of your answers so far(which did answer my poorly worded question).

推荐答案

继code将显示键盘您:

Following code will display keypad to you:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, 0);

但是,如果要强制出现应运而生的数字或电话按键键盘,那么你必须设置该特定视图/插件的输入类型。

However if you want to force the keyboard that appears into being the Number or telephone keypad, then you have to set the input type on that particular view/widget.

InputType.TYPE_CLASS_NUMBER; 
InputType.TYPE_CLASS_PHONE;

如。

your_edit_text.setInputType(InputType.TYPE_CLASS_NUMBER);

这篇关于InputMethodManager秀的WebView小键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆