【发布时间】:2019-08-26 22:31:39
【问题描述】:
您好,我已经在我的 android 清单中添加了所有内容,但是当显示键盘时布局正在剪切我的 xml。我期望的是没有任何东西被切断。
这是我的 xml...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="1dp"
android:orientation="vertical"
tools:context=".Chat.MessageListFragmentLadoComercial">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circle_image_chat_cliente"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp" />
<TextView
android:id="@+id/nombre_cliente_chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="15dp"
android:text="Nombre Cliente"
android:textColor="@android:color/white"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_hasta_abajo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="9">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/reyclerview_message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:padding="22dp" />
</androidx.core.widget.NestedScrollView>
<!-- A horizontal line between the chatbox and RecyclerView -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/layout_chatbox"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="1dp"
android:layout_weight="1"
android:background="#ffffff"
android:minHeight="48dp"
android:orientation="horizontal">
<EditText
android:id="@+id/edittext_chatbox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="Enter message"
android:isScrollContainer="true"
android:maxLines="6" />
<Button
android:id="@+id/button_chatbox_send"
android:layout_width="64dp"
android:layout_height="48dp"
android:layout_gravity="bottom"
android:layout_marginRight="30dp"
android:layout_marginBottom="0.5dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="SEND"
android:textSize="14dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
这是我的清单部分...
<activity
android:name=".Chat.MessageListActivityLadoComercial"
android:label="Chat"
android:windowSoftInputMode="adjustResize">
</activity>
这是它的样子......
所以我想做的是水平线性布局没有被切断,我尝试了一切但它似乎不起作用。
【问题讨论】:
-
尝试在你的 android manifest 的活动标签中使用
android:windowSoftInputMode="adjustPan" -
不,adjustPan 也不行!
标签: android xml material-design manifest