Android layout 当单击EditText链接消息时,工具栏和底部导航栏消失时,我如何调整它们?
我正在创建一个聊天片段。我面临的问题是,一些消息隐藏在键盘下,因此我找到了两种解决方案,但它们都不起作用Android layout 当单击EditText链接消息时,工具栏和底部导航栏消失时,我如何调整它们?,android-layout,android-edittext,android-relativelayout,android-textinputedittext,adjustpan,Android Layout,Android Edittext,Android Relativelayout,Android Textinputedittext,Adjustpan,我正在创建一个聊天片段。我面临的问题是,一些消息隐藏在键盘下,因此我找到了两种解决方案,但它们都不起作用 在活动标记之间的清单文件中添加android:WindowsOfInputMode=“adjustResize”无效 添加此android:WindowsOfInputMode=“adjustPan”不会隐藏消息,但工具栏和底部导航栏都会消失 以下是我的XML文件代码: <?xml version="1.0" encoding="utf-8"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:fitsSystemWindows="true"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_alignParentTop="true"
android:isScrollContainer="true"
android:id="@+id/empty_cart_appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/appBar_color"
android:minHeight="?attr/actionBarSize"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/btnBackFromChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:padding="16dp"
android:scaleType="center"
android:src="@drawable/ic_back_arrow"
android:tint="@color/white"
app:tint="@color/white" />
<TextView
android:id="@+id/txtSpecialistTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:ellipsize="end"
android:fontFamily="@font/atomicage_regular"
android:gravity="center"
android:maxLines="1"
android:text="Chat"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/listOfMessages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/msgLayout"
android:layout_below="@id/empty_cart_appBar"
android:layout_marginBottom="@dimen/_8sdp"
android:divider="@android:color/transparent"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/my_message" />
<LinearLayout
android:id="@+id/msgLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginRight="@dimen/_10sdp"
android:orientation="horizontal"
android:weightSum="4">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="@dimen/_36sdp"
android:layout_gravity="center"
android:layout_marginRight="@dimen/_8sdp"
android:layout_weight="3.5"
android:orientation="vertical"
app:cardBackgroundColor="@color/grey"
app:cardCornerRadius="@dimen/_20sdp">
<EditText
android:id="@+id/txtInputMsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="Type a message"
android:padding="@dimen/_8sdp"
android:textColor="@color/white"
android:textColorHint="@color/white" />
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/btnSendMsg"
android:layout_width="0dp"
android:layout_height="@dimen/_35sdp"
android:layout_gravity="center"
android:layout_marginTop="@dimen/_4sdp"
android:layout_marginBottom="@dimen/_4sdp"
android:layout_weight="0.5"
android:background="@drawable/cart_icon_bg"
android:backgroundTint="@color/appBar_color"
android:src="@drawable/ic_send_black_24dp" />
</LinearLayout>
</RelativeLayout>
```
Here I attach the pictures for both cases. How can we overcome this issue?
[![behaviour using adjustPan ][1]][1]
[![behaviour using adjustResize][2]][2]
[1]: https://i.stack.imgur.com/4mBKz.jpg
[2]: https://i.stack.imgur.com/wpnkt.jpg
```
这里我附上两种情况的图片。我们如何克服这个问题?
[![使用adjustPan的行为][1][1]
[![Behavior using adjustResize][2]][2]
[1]: https://i.stack.imgur.com/4mBKz.jpg
[2]: https://i.stack.imgur.com/wpnkt.jpg