关闭/隐藏Android的软键盘在Firefox [英] Close/hide android soft keyboard in firefox

查看:165
本文介绍了关闭/隐藏Android的软键盘在Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发小型筛选Android设备的Web应用程序。我的应用程序有一些投入,但它并不需要软键盘在所有(这键盘使用我的屏幕最大,从而隐藏重要的东西)。

I am developing a web application for small-screened android devices. My app has some inputs, but it does not need the soft keyboard at all (and this keyboard takes most of my screen, thus hiding important stuff).

如何设置集中到我的文字输入,未做软键盘出现?是否有在Firefox任何设置,为Android任何应用程序,或者是有一些黑客对JavaScript,让我这样做呢?

How can I set focus to my text inputs, without making soft keyboard appear? Is there any setting in firefox, any app for android, or maybe there is some hack for javascript that will allow me to do that?

PS。我现在想,正赶上了正在pssed对整个网页$ P $每一个关键,阅读是我的文字输入,但是这不是我想有行为的唯一解决方案。 :/

PS. The only solution I am currently thinking about, is catching every key that is being pressed on the whole webpage, and reading that as my text input, but that is not the behavior that I would like to have. :/

推荐答案

喜尝试输入的的onfocus属性,然后模糊()文字输入立即,如果你不满意,那么一个短暂的搜索后后,我有一个教程做只是经过这可能是它可以帮助你。

hi after trying out the onFocus attribute on the input, and then blur() the text input immediately, if you are not satisfied, then after a brief search i got a tutorial to do this just go through it may be it can help you

<一个href=\"http://www.sencha.com/forum/archive/index.php/t-141560.html?s=6853848ccba8060cc90a9cacf7f0cb44\" rel=\"nofollow\">http://www.sencha.com/forum/archive/index.php/t-141560.html?s=6853848ccba8060cc90a9cacf7f0cb44

您也可以从Java调用脚本的java code

you can also call java code from java script

...
WebView webView = (WebView) findViewById(R.id.webview);
webView.addJavascriptInterface(new JavaScriptInterface(this), "Android");

....

public class JavaScriptInterface {
    Context mContext;

    /** Instantiate the interface and set the context */
    JavaScriptInterface(Context c) {
        mContext = c;
    }

    /** Show a toast from the web page */
    public void hideKeyboard() {
        InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
        ...
    }
}

JavaScript的

javascript

<script type="text/javascript">
function hideAndroidKeyboard() {
    Android.hideKeyboard();
}
</script>

事情需要提防:

JavaScript来本地Java将无法在模拟器版本2.3+工作。
的https://$c$c.google.com/p /安卓/问题/细节?ID = 12987

Javascript to Native Java will not work on Simulator versions 2.3+. https://code.google.com/p/android/issues/detail?id=12987

这里有一些链接,可以帮助你。

here are some links that can help you

<一个href=\"http://stackoverflow.com/questions/20208463/keyboard-hide-input-positionfixed-bottom0-with-phonegap-on-android\">keyboard隐藏输入(位置:固定;底部:0;)在Android上使用PhoneGap的

https://github.com/phonegap/phonegap/wiki/How-to-show-and-hide-soft-keyboard-in-Android

来自简称:<一href=\"http://stackoverflow.com/questions/8335834/how-can-i-hide-the-android-keyboard-using-javascript\">How我可以隐藏使用JavaScript Android键盘?

这篇关于关闭/隐藏Android的软键盘在Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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