关闭或打开软键盘时更改列表视图的大小

Change size of Listview when closing or opening Softkeyboard

如何在关闭或再次打开软键盘时展开我的列表视图?我的列表视图当前已全屏显示。

问题:当我想滚动到我的 ListView 的最后一项时,我必须先关闭软键盘,因为软键盘隐藏了它(所以它在软键盘下面),这有点烦人。

我在 android 音乐播放器搜索功能中找到了一个我想要实现的示例,当我打开和关闭它时它看起来像这样(见滚动条)

有没有不费吹灰之力的方法?我已经在我的清单中尝试过了:

android:windowSoftInputMode="adjustResize"

但这并没有帮助。

编辑: 我的布局:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/listview_background">

    <RelativeLayout
        android:id="@+id/RelativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@color/colorPrimary"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/editText_searchbox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/imageView_btn_back"
            android:ems="10"
            android:hint=" Search"
            android:singleLine="true"
            android:textColor="#FFFFFF"
            android:drawableBottom="#FFFFFF"
            android:textColorHint="#FFFFFF" >

            <requestFocus />
        </EditText>

        <ImageView
            android:id="@+id/imageView_btn_back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/editText_searchbox"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/editText_searchbox"
            android:src="@drawable/ic_chevron_left_white_48dp" 
            android:onClick="btn_back"/>

    </RelativeLayout>

    <ListView
        android:id="@+id/listView_results"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:fastScrollEnabled="true"
        android:smoothScrollbar="true"
        android:focusable="false"
        android:drawSelectorOnTop="true"
        android:gravity="top"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:layout_below="@+id/RelativeLayout1">
    </ListView>

</RelativeLayout>

在 zgc7009 的帮助下,我发现 adjustResize 仅在全屏模式下布局为 NOT 时才有效。这通过更改我的 AppTheme 样式解决了所有问题。

如果有人知道如何在全屏模式下使用 adjustResize 请告诉我。

再次感谢zgc7009!