【问题标题】:Android Soft Keyboard covering WebView content覆盖 WebView 内容的 Android 软键盘
【发布时间】:2015-07-05 00:40:15
【问题描述】:

我正在尝试在我的 Activity 中使用 WebView 来显示标准登录页面,但是键盘似乎总是覆盖页面的下半部分(并且它不允许您“滚动”如您所料,未涵盖)。

查找问题,我已经尝试过常规

android:windowSoftInputMode="adjustResize"

但这似乎不起作用。 (我也试过adjustPan)

Now I found this issue,但我看到 Lollipop 中的应用会像您期望的那样滚动 web 视图。

有什么想法吗?我被难住了。

编辑:另外,我的活动没有使用全屏标志。

这是我的 Activity 的 XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_height="56dp"
        android:layout_width="match_parent"
        android:paddingTop="25dp"
        android:fitsSystemWindows="true"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:background="?attr/colorPrimary" />


    <WebView
        android:id="@+id/webview_login"
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

【问题讨论】:

  • 检查“fitsSystemWindows”属性
  • @IITAmiya 嗯,这似乎没有任何效果。我在我的 Activity 中拥有它的唯一视图是工具栏,即使在删除它之后,也会出现同样的问题。

标签: android webview


【解决方案1】:

也许你可以重写名为 onSizeChanged() 的方法如下:

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    if (onSizeChangedListener != null) {
        onSizeChangedListener.onSizeChanged(w, h, oldw, oldh);
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-15
    • 2021-08-05
    相关资源
    最近更新 更多