我花了几天的时间搞清楚这一点。实际上Sencha理解ViewPort高度存在问题。在您的index.html添加脚本块用下面的代码
if (window.device && parseFloat(window.device.version) == 7.0) {
document.body.style.paddingTop = "20px";
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}
这做了两件事你
- 它放到最上面提供了足够的空间,以显示活动吧
- 它集视窗高度为屏幕高度,不管键盘是否存在。
另外,如果您的应用程序在纵向和横向模式下工作,你需要在你的Viewport.js(或Main.js)
initialize: function(){
Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 0 });
},
handleOrientationChange: function(){
try{
if (parseFloat(window.device.version) == 7.0) {
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}else{
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight());
}
}catch(e){
// do nothing
}
},
添加这些行,是的,确保他们的键盘反弹是真实的(如果你正在使用科尔多瓦)。这将确保你的领域不被隐藏。
希望这对你有用。
我在某些情况下似乎有同样的问题。 –
如果我给面板提供高度(在我的代码中给出了设备高度),那么它的工作原理是正常的...但是当文本字段(小键盘)打开时,在键盘下出现的文本字段将再次失去焦点... – Avin
这工作对我来说:https://stackoverflow.com/a/19182670/6347279 –