安卓+ PhoneGap的:安卓windowSoftInputMode似乎不工作 [英] Android+PhoneGap: android:windowSoftInputMode doesn't seem to work

查看:384
本文介绍了安卓+ PhoneGap的:安卓windowSoftInputMode似乎不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个的PhoneGap的应用程序,我GOOGLE了很多关于如何做时,会出现虚拟键盘,我的WebView调整其高度,或者至少让虚拟键盘的高度。我发现很多帖子(包括计算器)的它说,

I'm developing a PhoneGap-based application and I googled much about how to make my webview adjust its height when virtual keyboard appears, or at least get height of the virtual keyboard. I found a lot of posts (including stackoverflow) which says that

android:windowSoftInputMode="adjustResize"

必须在清单中设置,我做到了。我还发现,PhoneGap的config.xml中有

must be set in the manifest and I did that. I also found that for PhoneGap config.xml there's

<preference name="android-windowSoftInputMode" value="adjustResize"/>

设置和我贴太多。我也尝试结合价值stateVisible | adjustResize(不只是adjustResize)这两个参数,但在我看来,它们都没有任何效果。我不知道,也许我做得不对,但你可以从模拟器检查截图(安卓4.0.3,但我也试过4.1.2和4.2.2):
http://screencast.com/t/Mm0mw8c693 - 键盘可见
http://screencast.com/t/lZ2DomqeRR - 键盘隐藏
在截图中我故意捕捉我的清单和config.xml的设置,因此您会发现他们实际上是在那里。
我还录制短片 - http://screencast.com/t/xI9PMcMJxxx

setting and I pasted that too. I also tried combined value 'stateVisible|adjustResize' (not just 'adjustResize') for both parameters, but it seems to me that they both have NO EFFECT. I don't know, maybe I'm doing something wrong, but you can check the screenshots from the emulator (Android 4.0.3, but I also tried 4.1.2 and 4.2.2):
http://screencast.com/t/Mm0mw8c693 - keyboard visible
http://screencast.com/t/lZ2DomqeRR - keyboard hidden
On the screenshot I intentionally captured my manifest and config.xml settings, so you may see they're actually there.
I even recorded short video - http://screencast.com/t/xI9PMcMJxxx

正如您可能会看到,没有任何视口中调整发生。 我还检查window.innerHeight使用的console.log(),并保持相同的可见和隐藏键盘。

As you may see, no any viewport resizing occur when keyboard shown / hidden. I also checked window.innerHeight using console.log() and it stays same for both visible and hidden keyboard.

请,给我一些建议。

推荐答案

windowSoftInputMode =adjustResize不工作,如果你的应用程序是全屏模式(设置全屏的config.xml )。这是Android的问题不是科尔多瓦。 发行CB-4404 被提出科尔多瓦bug跟踪了好几个月,但最近它结果指出它正在为Android上的错误预期跟踪器。

windowSoftInputMode="adjustResize" does not work if your app is in fullscreen mode (setting fullscreen to true in config.xml). It is Android's issue not Cordova. the issue CB-4404 was filed in Cordova bug tracker for months but recently it turns out that it is working as intended on Android bug tracker.

我通过设置全屏来解决这个问题,因为它不是为我的应用程序中的问题不去全屏。

I solved the problem by setting fullscreen to false since it wasn't a problem for my app not to go fullscreen.

这篇关于安卓+ PhoneGap的:安卓windowSoftInputMode似乎不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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