Phonegap:在Android中调整键盘显示的webview大小 [英] Phonegap: Resize webview on keyboard display in Android

查看:382
本文介绍了Phonegap:在Android中调整键盘显示的webview大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模态类似的(固定位置)到facebook在feed /聊天中的评论在最新的android版本中的信使。我想要的外观与此类似:

I have a modal similar (with fixed positioning) to what facebook has for the comments in feed/chat in messenger in the latest android release. What I want looks similar to this:

因此,当您专注于输入时,键盘会打开并缩小网页视图。它不工作,默认情况下,我找不到任何解决方案。

So when you focus on the input the keyboard opens and shrinks the webview. It's not working by default and I can't find any solution.

我尝试将此首选项添加到 config.xml ,但 adjustResize 不做任何事情, stateVisible 只是在启动应用程序时打开键盘。

I tried to add this preference to config.xml but adjustResize is not doing anything and stateVisible just opens the keyboard when I start the app.

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

这很奇怪。从 Android文档开始,adjustResize应该执行以下操作:

Which is weird. As of the Android Documentation adjustResize should do this:

The activity's main window is always resized to 
make room for the soft keyboard on screen.

我使用Phonegap 3.0,我有一个Nexus 5与kitkat测试。 / em>

I'm using Phonegap 3.0 and I have a Nexus 5 with kitkat for testing.

推荐答案

在我使用phonegap 3.0创建的项目中,默认情况下应用程序是全屏活动,键盘隐藏了应用程序

On my project created with phonegap 3.0, by default the app was full screen activity and the keyboard hid the app and the app was not resized.

我编辑config.xml并设置< preference name =fullscreenvalue =false/> ; ,那么应用程序不再是全屏,当软键盘打开时,应用程序已调整大小以适应屏幕的其余部分。

I edited config.xml and set <preference name="fullscreen" value="false" />, then the app was no more be full screen and when the soft keyboard was opened, the app was resized to fit the rest of the screen.

这篇关于Phonegap:在Android中调整键盘显示的webview大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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