ExpandableListView
中有swiperefreshlayout
,EditText
外有swiperefreshlayout
搜索功能。当焦点到EditText
软键盘会自动显示,ListView
将其高度变小。但在软键盘消失后,ListView的高度不会改变为正常大小。
这是xml布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#3D4047"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="4dp" >
<EditText
android:id="@+id/inpSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:singleLine="true"
android:textColor="#DDD"
android:textColorHint="#DDD"
android:background="@drawable/edit_text_selector"/>
<ImageButton
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="4dp"
android:background="@null"
android:paddingBottom="2dp"
android:src="@drawable/ic_action_clear"
tools:ignore="ContentDescription" />
</RelativeLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ExpandableListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
如何根据键盘外观动态更改ListView的高度?提前致谢