【发布时间】:2013-05-29 09:29:38
【问题描述】:
我正在使用 PhoneGap (Cordovar 2.5) 和 jQuery Mobile 1.3.0。在 iOS 上,每当我关注文本框时,键盘都会显示并向上推页面,但在 Android 上却没有。我曾尝试使用android:windowSoftInputMode="",但没有成功。请帮忙。
【问题讨论】:
我正在使用 PhoneGap (Cordovar 2.5) 和 jQuery Mobile 1.3.0。在 iOS 上,每当我关注文本框时,键盘都会显示并向上推页面,但在 Android 上却没有。我曾尝试使用android:windowSoftInputMode="",但没有成功。请帮忙。
【问题讨论】:
在你应用程序的任何部分(当然是 js 文件)输入这个脚本:
if(/Android 4\.[0-3]/.test(navigator.appVersion)){
window.addEventListener("resize", function(){
if(document.activeElement.tagName=="INPUT"){
window.setTimeout(function(){
document.activeElement.scrollIntoViewIfNeeded();
},0);
}
})
}
答案在:Android does not correctly scroll on input focus if not body element
【讨论】: