我有一个使用Phonegap和JQuery Mobile构建的应用程序。每当软键盘显示 - 在表单输入等 - 整个页面调整大小。图像,按钮和文字。我假设是破坏CSS的东西?
其他人有这个问题,或者知道为什么会这样?我不得不重新启动应用程序来重置布局。
任何想法都赞赏!
谢谢!
答案 0 :(得分:14)
我在这里找到了答案:
http://solutions.michaelbrooks.ca/2011/07/05/android-soft-keyboard-resizes-web-view/
http://comments.gmane.org/gmane.comp.handhelds.phonegap/10207
添加:
的组合android:windowSoftInputMode="adjustPan"
到AndroidManifest.xml
和<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />
到index.html,为我做了这份工作。
希望这有助于某人。
答案 1 :(得分:2)
对于Phonegap Build用户,config.xml文件中有一个包装首选项,
<preference name="android-windowSoftInputMode" value="stateHidden|adjustPan" />
它可以采取的值与android原生属性相同,如果您需要有关参数和行为的其他信息,请参阅此处的android开发者指南:http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
我使用Phonegap Build 3.3.0和jQuery Mobile进行了测试,对我来说很好,希望它有所帮助。
答案 2 :(得分:0)
对于这个问题,我有一个经过验证的解决方案,我也遇到了同样的问题,但我自己解决了这个问题。 首先在body中创建一个字段并使其隐藏,或者你可以使用z-index使其隐藏在div之后,以便它不会被显示。
<script>
$(document).ready(function() {
document.getElementById('example').value='';
});
</script>
<body>
<div style='z-index:50;position:absolute;height:100%;width:100%;'>
Your page matter here</div>
<select id='example' style='z-index:10'>
<option value=''>a</option>
</select></pre>
</body>
moto是我们必须在页面加载时设置这个选择字段,并且这样做肯定会停止闪烁...尝试它们......它对我有用