我花了幾天的時間搞清楚這一點。實際上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 –