简体   繁体   English

如何在Phonegap / Cordova应用中禁用键盘?

[英]How to disable keyboard in Phonegap/Cordova app?

I'm creating a aplication with cordova/phonegap and I need to disable the keyboard even when I'm inside a textbox. 我正在使用cordova / phonegap创建应用程序,并且即使在文本框中也需要禁用键盘。 I dont want the keyboard appears in any situation. 我不希望键盘在任何情况下都出现。 The application has a textbox that occupies most of the window. 该应用程序有一个文本框,占据了大部分窗口。 Below is a zone of buttons that are right for putting text inside the textbox. 下面是一个按钮区域,用于将文本放入文本框。

If I put the textbox 'readonly' the keyboard dont appear but I need to see where the pointer is currently located. 如果我将文本框设置为“只读”,则不会出现键盘,但是我需要查看指针当前位于何处。

Mi apllication is for Android. Mi适用于Android。

Thanks very very much! 非常非常感谢!

You can use soft keyboard to hide it. 您可以使用软键盘将其隐藏。 It is available at github all you have to do is put in this code after the plugin soft keyboard has been added: 可以在github上找到它,您要做的所有事情就是在添加了插件软键盘之后将以下代码放入此代码中:

plugins.SoftKeyBoard.hide(function () {
// success
 },function () {
// fail
});

Or/And you could add or change the meta tag in your head tags of html to: 或/并且您可以在html的头部标签中添加或更改meta标签为:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />

If you don't want to run the keyboard at all during the app just remove the plugin and don't use it. 如果您不想在应用程序期间完全运行键盘,只需删除插件即可,不要使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM