如何切换[使用物理键盘&QUOT ;. [英] How to toggle "Use Physical Keyboard".
问题描述
我开发一个应用程序,我有RFID读写器(模拟键盘)。在一些活动,我需要一个虚拟键盘,以及。我发现,我需要的是切换使用物理键盘。这工作正常,但是当我重新启动我的平板电脑,该功能被设置为默认?
I am developing an application where I have RFID reader (emulates keyboard). In some activities I need a virtual keyboard as well. I have discovered that all I need is to toggle "Use Physical Keyboard". That works fine, but when I restart my tablet, this feature is set to default?
是否有可能,如果我可以在我的code某处插入一个切换?
Is it possible, if I can insert a toggle somewhere in my code?
推荐答案
我可以切换屏幕上的键盘,具有以下code:
I was able to toggle the on-screen keyboard, with the following code:
InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
在参考,使用的EditText 。
的EditText是很薄的木皮超过TextView中的自身配置为可编辑。
"EditText is a thin veneer over TextView that configures itself to be editable."
要显示屏幕键盘,他们需要做的是在文本框中联系。如果箱子被命名为搜索或类似的东西,我相信这将是一个比一个按钮,用户更加有用。
To display the on-screen keyboard, all they need do is touch in the textbox. If that box was named "Search" or something similar, I believe it would be more useful to a user than a button.
这篇关于如何切换[使用物理键盘&QUOT ;.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!