在 Ionic iOS 应用程序中打开键盘会将背景图像向上移动
Opening keyboard in Ionic iOS app moves the background image up
在 iOS 中打开键盘时,我的 ion-content 的背景图像被上移了。我怎样才能阻止这个?
我使用的是 Capacitor 而不是 Cordova。
<ion-content>
<div class="content">
.content {
width: 100%;
height: 100%;
padding: 0;
position: relative;
background: url("./../../../assets/img/login-bg.jpg") no-repeat fixed center;
background-size: cover !important;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: left;
}
我已经在 AndroidManifest.xml 中找到 Android 的解决方案:
<activity android:windowSoftInputMode="adjustPan" />
对于 iOS 将此添加到 capacitor.config.json
{
"plugins": {
"Keyboard": {
"resize": "body",
"style": "dark"
}
}
}
在此处查看文档:https://capacitor.ionicframework.com/docs/apis/keyboard
对于Android:
将此添加到 AndroidManifest.xml:
<activity android:windowSoftInputMode="adjustPan" />
在 iOS 中打开键盘时,我的 ion-content 的背景图像被上移了。我怎样才能阻止这个? 我使用的是 Capacitor 而不是 Cordova。
<ion-content>
<div class="content">
.content {
width: 100%;
height: 100%;
padding: 0;
position: relative;
background: url("./../../../assets/img/login-bg.jpg") no-repeat fixed center;
background-size: cover !important;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: left;
}
我已经在 AndroidManifest.xml 中找到 Android 的解决方案:
<activity android:windowSoftInputMode="adjustPan" />
对于 iOS 将此添加到 capacitor.config.json
{
"plugins": {
"Keyboard": {
"resize": "body",
"style": "dark"
}
}
}
在此处查看文档:https://capacitor.ionicframework.com/docs/apis/keyboard
对于Android: 将此添加到 AndroidManifest.xml:
<activity android:windowSoftInputMode="adjustPan" />