Android 调整编辑文本的大小
您好,我已经在我的android清单中添加了所有内容,但是当显示键盘时,布局正在剪切我的xml。我所期望的是没有任何东西被切断 这是我的xmlAndroid 调整编辑文本的大小,android,xml,material-design,manifest,Android,Xml,Material Design,Manifest,您好,我已经在我的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"
<?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>
因此,我想做的是,水平线性布局没有被切断,我尝试了所有方法,但似乎都不起作用。使用RelativeLayout
而不是LinearLayout
,在您的情况下linearLayout2
,因为它可以跨越所有可用空间,因此可以在键盘弹出时调整大小。但是LinearLayout在调整大小的过程中不会调整大小,因此您的带有circleimageview和title的顶级LinearLayout无法调整大小。尝试在您的android manifestnope活动标签中使用android:WindowsofInputMode=“adjustPan”
,adjustPan也不会这样做!
<activity
android:name=".Chat.MessageListActivityLadoComercial"
android:label="Chat"
android:windowSoftInputMode="adjustResize">
</activity>