【发布时间】:2013-11-26 17:12:25
【问题描述】:
我使用 2.9.0 版本的 Phonegap,我希望当键盘出现时,我的 WebView 会像在 Android phonegap 应用程序中那样缩小。我在固定位置有页脚和页眉元素,当键盘打开时会导致问题(页脚和页眉松动它们的固定位置状态)。
根据 phonegap 文档,我认为 KeyboardShrinksView 设置可以解决这个问题:http://docs.phonegap.com/en/2.9.0rc1/guide_project-settings_ios_index.md.html#Project%20Settings%20for%20iOS
但是经过大量尝试我无法使其工作,WebView 不会缩小。
我在想也许它可能来自我在 config.xml 中设置的其他首选项之间的冲突:
config.xml
<gap:platform name="ios" />
<gap:platform name="android" />
<preference name="fullscreen" value="false" />
<preference name="webviewbounce" value="false" />
<preference name="orientation" value="portrait" />
<preference name="KeyboardShrinksView" value="true" />
或者它可能来自元标记定义,特别是视口:
index.html
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
你知道为什么它不工作吗?或者您有解决方法吗?
编辑:我已经看到它在 KeyboardShrinksView=true 时发生了一些变化,但是当键盘打开时,它隐藏了我的内容的底部(包括我的页脚和字段),而不是调整我的整个内容的大小。我希望它会将我的页脚放在键盘顶部,对吗?
感谢您的帮助
【问题讨论】:
-
你发现了吗?
-
还没有,我放弃了,因为它似乎无法修复。我只是在 JavaScript 中做了一些“肮脏”的技巧来动态计算并重新定位页脚和页眉
-
你有什么解决方案?
-
@tomahim 你有解决办法吗?
标签: ios cordova webview keyboard