我正在创建 android 聊天应用程序。
但是,当键盘打开时,它几乎不会覆盖 EditText。
如果我使用“adjustResize”,它不会覆盖 EditText,但会覆盖 ListView。
显现:
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lV_chat"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/linearLayout3"
android:background="@color/gray"
android:layout_below="@+id/toolbarChat"
android:divider="@null"
android:paddingRight="@dimen/space_6dp"
android:paddingLeft="@dimen/space_6dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/chat_text_input_height"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:id="@+id/linearLayout3"
android:background="@color/white">
<EditText
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/eT_chat"
android:layout_weight="1"
android:background="@color/transparency"
android:layout_marginLeft="@dimen/space_20dp"
android:textCursorDrawable="@null" />
<ImageButton
android:layout_width="@dimen/chat_send_button_width"
android:layout_height="match_parent"
android:id="@+id/iB_send"
android:background="@color/light_blue"
android:src="@drawable/ic_send"
android:scaleType="centerInside" />
</LinearLayout>
</RelativeLayout>