[英]Where is the “showkeyboard” event coming from?
我正在使用PhoneGap,我需要在Android手機上捕獲“鍵盤正在顯示”事件。
我發現一些線程說要使用“ showkeyboard”事件。 (例如: 顯示隱藏鍵盤在android phonegap中無法正常工作 )
我的問題 :這是可與phonegap一起使用的android事件嗎? 這是一個簡單的phonegap事件嗎? 這是瀏覽器事件嗎? 這是經典的javascript事件嗎?
我沒有找到有關此事件的任何文檔,我需要它,因為它還會觸發方向更改...
編輯:我發現了這個,說這是從android上來的,但未記錄在案: https : //issues.apache.org/jira/browse/CB-6154
這些事件來自Android , 但未記錄 。 我遇到了一些麻煩,所以我建議不要使用它們。
為了提供信息,為了使我的功能正常工作,我已經做了類似的事情(這只是一般性的想法):
this._keyboardTimer;
document.addEventListener('showkeyboard', function (e) {
clearTimeout(this._keyboardTimer); // keep only the last event
this._keyboardTimer = setTimeout(function(oldOrientation){
if (oldOrientation != getOrientation()) {
/* this is an orientation event */
} else {
/* keyboard is really opening */
}
}.bind(this, getOrientation()), 200);
}.bind(this), false);
function getOrientation() {
return ( (window.orientation == 90) || (window.orientation == -90) )
? 'landscape'
: 'portrait';
};
我在'hidekeyboard'事件中也做了同樣的事情。 希望這會有所幫助。
[編輯]還有另一個問題(奇怪!):鍵盤可能略有不同。 如果鍵盤更改為較小的鍵盤:則觸發“ hidekeyboard”事件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.