我正在使用Ionic ver 3.9.2
我想在iOS上推送视图,这样我的页脚就不会隐藏了 .
不希望键盘覆盖我的页脚
在Android上,我可以使用android:windowSoftInputMode = "adjustResize",这神奇地缩小了视图 . 有没有办法实现这个目标?
您可以使用Ionic Keyboard Plugin的 onKeyboardShow() 和 onKeyboardHide() 来了解何时调整屏幕大小以排除键盘 .
onKeyboardShow()
onKeyboardHide()
尝试进行以下更改,看看它是否符合您的要求 . 您将需要调整keyboard_height和缓动以正确地使其工作
app.html
<ion-nav .... [style.height]="nav_style"></ion-nav>
app.component.ts
keyboard_height: number = 200; nav_style: string = null; constructor(private keyboard: Keyboard, private platform: Platform, ...){ if(this.platform.is('ios')){ this.keyboard.onKeyboardShow(() => { this.nav_style = 'calc(100%-' + this.keyboard_height + 'px)'; }); this.keyboard.onKeyboardHide(() => { this.nav_style = null; }); } }
app.scss
ion-nav{ transition: height 0.2s ease-out }
1 回答
您可以使用Ionic Keyboard Plugin的
onKeyboardShow()
和onKeyboardHide()
来了解何时调整屏幕大小以排除键盘 .尝试进行以下更改,看看它是否符合您的要求 . 您将需要调整keyboard_height和缓动以正确地使其工作
app.html
app.component.ts
app.scss