Android:是否可以通过编程方式打开或关闭物理键盘? [英] Android: Is there any way to turn on-off the physical keyboard programmatically?

查看:199
本文介绍了Android:是否可以通过编程方式打开或关闭物理键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有USB主机功能的android 3.1.我通过usb用作键盘仿真器的RFID阅读器连接到它.对于键盘仿真器,我的意思是,一旦我扫描了标签,它就会将输出作为击键发送.

I have an android 3.1 with usb host capabilities. I connected to it via usb an RFID reader that works as a keyboard emulator. For keyboard emulator I mean that once I scan a tag it sends the output as keystrokes.

现在,一旦插入此阅读器,就无法使软键盘可见.因此,除了rfid代码外,别无其他输入.

Now once this reader is plugged in there is no way to have the soft keyboard visible. So it's impossible to type anything else than the rfid codes.

我尝试了强制显示软键盘"的示例,但没有成功:它们一直起作用,直到我插入RFID阅读器.然后,无论如何,软键盘都会消失!

I have tried without success the examples to "force show soft keyboard": they work until I plug in the RFID reader. Then the soft keyboard disappears no matter what!!!

我的软件将在信息亭模式"下运行,这就是为什么我要求以编程方式执行此过程.这不是可用性问题.

My software will work on "kiosk mode", that's why I ask about doing this process programmatically. This is not a matter of usability.

我们非常感谢您的帮助.

Any help is really appreciated.

推荐答案

您是否有任何editText或类似内容可以通过这种方式获得焦点?

Have you got any editText or similar to get the focus this way?

someEditText.requestFocus();
InputMethodManager mgr = (InputMethodManager)getActivity(). 
getSystemService(Context.INPUT_METHOD_SERVICE);                 
mgr.showSoftInput(someEditText, InputMethodManager.SHOW_IMPLICIT);

我的意思是,如果您在插入RFID阅读器之后执行此操作,则键盘应该会出现.你尝试过吗?

I mean, if you do this after plugging your RFID reader, the keyboard should appear. Did you try this?

这篇关于Android:是否可以通过编程方式打开或关闭物理键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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