我知道已经被问过几次了,但是没有一个答案可以解决。
<preference name="fullscreen" value="false" />
并不是真正的解决方法,因为我希望应用程序全屏显示。
配置文件选项似乎没有任何作用。我尝试过:
android:windowSoftInputMode="adjustPan"
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustResize|stateHidden"
由于没有滚动空间,滚动偏移也不起作用。
$('.myinput').focus(function(e) {
var container = $('.container'),
scrollTo = $('.myinput');
setTimeout((function() {
container.animate({
scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()
});
}), 500);
});
答案 0 :(得分:1)
请安装:
cordova plugin add ionic-plugin-keyboard --save
然后做cordova准备将此新插件加载到您的www文件夹中。
document.addEventListener('deviceready', function(e){
window.addEventListener('native.keyboardshow', function () {
cordova.plugins.Keyboard.disableScroll(true);
});
});
或者您可以尝试使用此javascript函数
<script>
setInterval(function(){
if( document.body.className.match('keyboard-open') ) {
document.getElementById("messagearea").style.marginBottom="100px";
}
else{
document.getElementById("messagearea").style.marginBottom="0px";
}
}, 1000);
</script>