Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android键盘覆盖recyclerView下的编辑文本_Android_Android Recyclerview_Android Edittext - Fatal编程技术网

Android键盘覆盖recyclerView下的编辑文本

Android键盘覆盖recyclerView下的编辑文本,android,android-recyclerview,android-edittext,Android,Android Recyclerview,Android Edittext,你能试试这个吗?从NestedScrollView中删除包含TextInputText的线性布局,并将WindowsOfInputMode设置为调整大小,如下所示: android:windowSoftInputMode="adjustResize" 在清单文件中: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://s

你能试试这个吗?从NestedScrollView中删除包含TextInputText的线性布局,并将WindowsOfInputMode设置为调整大小,如下所示:

 android:windowSoftInputMode="adjustResize"
在清单文件中:

<?xml version="1.0" encoding="utf-8"?>
<layout 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">

<data>

    <variable
        name="viewModel"
        type="app.redtaxi.client.views.chat.ChatViewModel" />
</data>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:isScrollContainer="true"
        android:scrollbars="none">


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/lesser_white"
            android:gravity="bottom"
            android:paddingTop="25dp"
            tools:context=".views.chat.ChatActivity">


            <RelativeLayout
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:layout_marginStart="10dp"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="16dp"
                android:background="@drawable/round_shape"
                android:clickable="true"
                android:elevation="4dp"
                android:focusable="true"
                android:onClick="@{() -> viewModel.onBackBtnClicked()}">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:padding="10dp"
                    android:src="@drawable/ic_back_arrow" />

            </RelativeLayout>


            <ImageView
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_alignParentTop="true"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="10dp"
                android:layout_marginEnd="10dp"
                android:layout_marginBottom="16dp"
                android:background="@drawable/round_shape"
                android:clickable="true"
                android:elevation="4dp"
                android:focusable="true"
                android:onClick="@{() -> viewModel.onCallBtnClicked()}"
                android:src="@drawable/ic_call_black" />


            <TextView
                android:id="@+id/chat_title_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:text="Mr. Samer Saadeh"
                android:textColor="@color/black"
                android:textSize="18sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/chat_car_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/chat_title_tv"
                android:layout_centerHorizontal="true"
                android:text="17 - White Hyundai"
                android:textColor="@color/text_gray"
                android:textSize="14sp"
                android:textStyle="bold" />


            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/chat_recyclerView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@id/chat_layout"
                android:layout_below="@id/chat_car_tv"
                android:layout_marginTop="5dp"
                tools:itemCount="15"
                tools:listitem="@layout/item_chat" />

            <LinearLayout
                android:id="@+id/chat_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="45dp"
                android:orientation="horizontal"
                android:paddingStart="15dp"
                android:paddingEnd="15dp">

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/chat_cv"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="0.9"
                    android:elevation="5dp"
                    android:theme="@style/Theme.MaterialComponents.Light"
                    app:cardCornerRadius="30dp"
                    app:strokeColor="@color/gray_light"
                    app:strokeWidth="0.5dp">

                    <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@color/white"
                        android:padding="10dp">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/chat_et"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:background="@null"
                            android:ems="11"
                            android:hint="@string/type_a_message"
                            android:singleLine="true"
                            android:textColor="@color/text_black"
                            android:textColorHint="@color/hint_gray"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintStart_toStartOf="parent"
                            app:layout_constraintTop_toTopOf="parent"
                            app:layout_constraintWidth_percent="0.7" />

                        <ImageView
                            android:id="@+id/chat_attach_iv"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_marginEnd="10dp"
                            android:clickable="true"
                            android:focusable="true"
                            android:src="@drawable/ic_attach"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintEnd_toStartOf="@id/chat_camera_iv"
                            app:layout_constraintTop_toTopOf="parent" />

                        <ImageView
                            android:id="@+id/chat_camera_iv"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_marginEnd="15dp"
                            android:clickable="true"
                            android:focusable="true"
                            android:src="@drawable/ic_camera"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintEnd_toEndOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                    </androidx.constraintlayout.widget.ConstraintLayout>
                </com.google.android.material.card.MaterialCardView>

                <ImageView
                    android:id="@+id/chat_record_iv"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:src="@drawable/ic_mic_btn" />

            </LinearLayout>


        </RelativeLayout>
    </androidx.core.widget.NestedScrollView>
</RelativeLayout>
布局文件如下所示:

 android:windowSoftInputMode="adjustResize"


当我将其从android清单(y)更改为android:WindowsofInputMode=“adjustResize”时,我面临的问题与已解决的问题相同。如果您询问adjustResize解决问题的原因,您可以查看此链接这是adjustResize在android清单中设置时所做的操作。它允许活动的主窗口始终调整大小,以便为屏幕上的软键盘腾出空间。