【问题标题】:Is there a way to make the keyboard not be on top of ion-input?有没有办法让键盘不在离子输入之上?
【发布时间】:2019-08-14 11:21:29
【问题描述】:

我们正在部署一个 Ionic 应用程序,但我们刚刚发现,当离子输入聚焦时,键盘位于离子输入顶部。我应该如何改变它?

在过去的八小时里我一直在寻找解决方案,但我尝试过的所有方法都不起作用。

这是我找到的一些页面:

https://www.bountysource.com/issues/35651824-keyboard-overlaps-the-text-input-when-the-input-is-placed-inside-an-ion-footer

https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard

https://github.com/ionic-team/ionic-v3/issues/117 及相关页面。

<ion-list>
    ...
    <!--There are some element before, so that this one is at the bottom-->
    <ion-item>
        <ion-label position="floating">Description</ion-label>
        <ion-textarea type="text"
                      id="description"
                      [rows]="6"
                      [maxlength]="255"
                      name="description"
                      placeholder="Having more things to say ?"
                      [(ngModel)]="announce.description"
                      #description="ngModel"
                      required></ion-textarea>
    </ion-item>
    <div class="error-text" padding-start padding-end margin-bottom>
        <small>
            <span *ngIf="description.touched && description?.errors?.required">Required</span>
            <span *ngIf="description.touched && description?.errors?.maxlength">The max value 255</span>
        </small>
    </div>

</ion-list>

预期:

正如标题所说,我希望键盘出现在页脚的底部。

实际:

键盘位于离子文本区域的顶部。当我输入时它没有显示。

【问题讨论】:

    标签: angular cordova ionic-framework ionic4


    【解决方案1】:

    经过一番调查,问题实际上不在键盘或其他问题上,而只是在导致应用程序被拉下的状态栏插件上,不知何故,Cordova 不再知道屏幕的高度.

    说明

    我使用StatusBar.overlaysWebView(true) 将应用程序屏幕放在状态栏顶部,以便它可以处理颜色变化。

    这样做正是问题所在,正如他们在opened issue on GitHub 中所解释的那样。

    解决方案

    使用

    cordova plugin add https://github.com/breautek/cordova-plugin-statusbar.git#issue-110-statusbar-overlay-keyboard-resize
    

    安装同一插件的另一个版本,这将解决问题。

    但同时问题应该已经合并了,如said in the same thread

    【讨论】:

      猜你喜欢
      • 2022-06-28
      • 1970-01-01
      • 1970-01-01
      • 2015-10-05
      • 2014-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多