Android 如何在打开软键盘时不向上移动布局

Android 如何在打开软键盘时不向上移动布局,android,xml,android-softkeyboard,Android,Xml,Android Softkeyboard,我知道这似乎是一个重复的问题,事实上我已经提到了这些问题,但这些问题似乎都不适合我,所以我在这里 我的布局有两个主要部分:一个实时视频提要和它下面的一个聊天框。每当我打开键盘时,它就会将我的视频部分和应用程序栏向上移出屏幕,我希望视频部分保持原样,我尝试了许多不同的布局,windowSoftInputMode,但没有任何帮助 以下是我的布局: <androidx.constraintlayout.widget.ConstraintLayout android:layout_widt

我知道这似乎是一个重复的问题,事实上我已经提到了这些问题,但这些问题似乎都不适合我,所以我在这里

我的布局有两个主要部分:一个实时视频提要和它下面的一个聊天框。每当我打开键盘时,它就会将我的视频部分和应用程序栏向上移出屏幕,我希望视频部分保持原样,我尝试了许多不同的布局,
windowSoftInputMode
,但没有任何帮助

以下是我的布局:

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/linearLayout7">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/constraintLayout2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:orientation="vertical"
            android:visibility="visible"
            app:layout_constraintBottom_toBottomOf="parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:layout_constraintBottom_toTopOf="@+id/linearLayout3">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <androidx.core.widget.NestedScrollView
                        android:id="@+id/tscroll"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingTop="42dp"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent">

                        <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/show_chat"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent" />

                    </androidx.core.widget.NestedScrollView>

                </androidx.constraintlayout.widget.ConstraintLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout3"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:background="@drawable/chatbox"
                android:weightSum="3"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent">

                <EditText
                    android:imeOptions="flagNoExtractUi"
                    android:id="@+id/textmassge"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="2.2"
                    android:autofillHints=""
                    android:hint="@string/enter_message"
                    android:inputType="text"
                    android:textColor="@color/colorPrimary"
                    android:textColorHint="@color/colorSelect"
                    android:textSize="20sp" />

                <ImageView
                    android:id="@+id/attach"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.4"
                    android:background="@android:color/transparent"
                    android:onClick="choose_file"
                    android:padding="13dp"
                    android:src="@drawable/attachment"
                    android:tint="@color/colorAccent" />

                <ImageView
                    android:id="@+id/send_button"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.4"
                    android:background="@android:color/transparent"
                    android:onClick="sendmessage"
                    android:padding="13dp"
                    android:src="@drawable/send"
                    android:tint="@color/colorAccent" />
            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

    <!--GLSurface View Starts-->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/linearLayout7">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/mainlayout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2">

            <android.opengl.GLSurfaceView
                android:id="@+id/cameraPreview_surfaceView"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:visibility="visible"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

   
</androidx.constraintlayout.widget.ConstraintLayout>